postmaster#servername.mydomain.com as "from" address - asp.net

Very first time in 6 years, my client has reported that they are receiving email from my asp.net web applicaation with "from" id as "postmaster#servername.mydomain.com". Though, the mail id I use to send emails are "support#mydomain.com".
Not all the emails are delivered with postmaster# as "from" address.
The "to" address of these kind of emails are like donotreply# . So if a "to" address belongs to "donotreply" category, will SMTP will change the original "from" address to "postmaster#"?
We haven't faced this anytime before but why is it occurring now? I googled and found https://webmasters.stackexchange.com/questions/2030/should-i-set-up-standard-email-accounts-what-are-they and Do I really need webmaster#domain.com, postmaster#domain.com, etc. emails? but not sure what it has to do with my SMTP.
Can someone help me understand why it is happening?

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6bb0d71f-d3d7-4f59-aa01-4d5c022274a4.mspx?mfr=true
From the above link,
To rename the default domain
1.In IIS Manager, expand the SMTP virtual server, and then click Domains.
2.In the details pane, right-click a domain name, and then click Rename.
3.Type a new name for the default domain.
For me the domain name was "servername.mydomain.com" and I modified it as "mydomain.com"

Related

How to set hostname used in JavaMail or Apache James Message-Id header?

I am having issues with mail bouncing when sending from my own server to my own active yahoo account using JavaMail. The mails are passing SPF, DKIM and DMARC according to google mail that receives the same messages being bounced by yahoo. I can send messages from other accounts to my yahoo account without issue.
The messages send fine from my server to ZMail, GMail, Microsoft mail. Looking at the emails, the only thing that I have noticed is the message header for the Message-Id. My messages have the following header:
Message-ID: <923936395.17.1634776639078#[internally visible hostname]>
I am wondering if this header could be the problem and whether there is a way in JavaMail or in the Apache James to set the hostname or IP address that gets used in this message so that rather than using the "internally visible hostname", I can get the hostname that is externally visible. I have been searching the available documentation for Apache James and JavaMail but have not found any parameters to try in order to resolve this.
According to the Decompiled SRC of sun mail it should be possible by setting some properties for your session.
props.setProperty("mail.from", user);
props.setProperty("mail.host", host);
//props.setProperty("mail.user", user);
The Id will be updated by the save method (saveChanges()) and will trigger an new ID generation (updateHeaders() -> updateMessageID()). (Looked up in the decompiled MimeMessage.class)
Leading to the HostPart called in javax.mail.internet.InternetAddress.
The relevant method is _getLocalAddress.
Here you can see that the values get extracted from the Properties or will fallback to your local machine.
Used Fields:
user.name
mail.from
mail.user
mail.host
The user.name property can also be looked up from the system props.

Error Sending mail through Gmail SMTP relay [duplicate]

This question already has answers here:
Sending email in .NET through Gmail
(26 answers)
Closed 2 years ago.
I'm working on building a contact form for my new Web site and want to send mail through Google's SMTP relay server (smtp-relay.gmail.com) because I want to set up a "dummy", "no-reply" address from which to send the mail. Also, I tried sending it through the regular SMTP server (smtp.gmail.com) using my own actual Gmail credentials for that account and it got blocked as an insecure app. I'd rather not turn on the "Less secure app access" option (it's not really an option for me anyway because I use 2FA on this account), so this seems like the best way to get there - if I can get it working.
The domain's mail is hosted in G Suite and I've configured the SMTP relay service in the Google Admin Console for my domain as per the instructions in the support article, SMTP relay: Route outgoing non-Gmail messages through Google. I have the relay configured using both the public static IP address of my Web site, as well as the static IP address of the firewall behind which the Web server lies. I configured the relay to accept mail from my domain(s) to allow for the "dummy" address that doesn't actually have a mailbox, and set it to require SMTP Authentication and TLS encryption:
I've set up DNS records for MX, SPF, and DKIM with my domain registrar.
I've waited over 24-hours for the changes to take effect (as per the notification when making the changes in the Google Admin Console)
I've even set up an app password for my Web site to use for my domain e-mail address:
I'm using an ASP.NET (VB) Web site on IIS. My code for sending looks like this:
Dim NewContact As New System.Net.Mail.MailMessage()
With NewContactMessage
.From = New System.Net.Mail.MailAddress("no-reply#mydomain.com")
.To.Add("myaddress#mydomain.com")
.Subject= "TEST MESSAGE"
.IsBodyHtml= True
.BodyEncoding = System.Text.Encoding.UTF8
.Body = "This is a test."
.Priority = System.Net.Mail.MailPriority.Normal
End With
Dim Server As New System.Net.Mail.SmtpClient()
With Server
.Port= 587
.Host= "smtp-relay.gmail.com"
.EnableSsl= True
.Send(NewContactMessage)
End With
However, when I try to submit my contact form, I get an error, Mailbox unavailable. The server response was: 5.7.1 Invalid credentials for relay [X.X.X.X]. The IP address you've:
It looks like there should definitely be more to that actual error message, but it's apparently being truncated somewhere along the way.
I've tried feeding the credentials in the SmtpClient block:
With Server
.Credentials = New System.Net.NetworkCredential("myaddress#mydomain.com", "my_app_password")
.Port= 587
.Host= "smtp-relay.gmail.com"
.EnableSsl= True
.Send(NewContactMessage)
End With
In this case, I get a different error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at. (If I use the credentials with the "default" Gmail SMTP server (smtp.gmail.com), I get the same error.)
According to the Audit Logs, it appears that all of my configuration setting changes have completed. Everything appears to be correct for this to work, but what am I missing?
Just before posting this question, I found this Q&A - Send mail via google app with smtp relay - with the simple fix to my issue: Turn off the Require SMTP Authentication option in the SMTP relay service configuration settings.
Once I disabled that setting and tried again, everything is flowing normally. I suppose I should have figured that out on my own, but according to Google's support article for setting up the SMTP relay (emphasis mine in the first sentence):
In the Authentication section, check one or both boxes to set an authentication method:
Only accept mail from the specified IP addresses — The system only accepts mail sent from these IP addresses as coming from your domains.
Require SMTP Authentication — Enforces the use of SMTP authentication to identify the sending domain. Using this option requires your clients to connect via TLS.
The wording here seems a bit misleading and appears to indicate that you can have both of these options enabled without one "interfering" with the other. As I said, I probably should have figured this out on my own - especially since I'm trying to send from a "dummy" e-mail account - but I guess it just didn't occur to me.
I considered deleting this question, but I had done a fair amount of searching before writing this question up and somehow never ran across that particular post. I'm not sure how I could have missed it, but I'm leaving my question here in hopes that someone else has an easier time of finding this solution in the future.

Qmail email address without hostname/domain name

In our production a user sent an email to the following address "xxx" (Literally the email is address xxx). This address is within our companies organization (xxx#company.com.ph), I am being asked how it was sent without "#company.com.ph".
I told them it was probably the configuration of our SMTP server as I am sure the application I made is not appending "#company.com.ph" to mails without (hostName/domainName).
Our SMTP server is Qmail in a Unix box. Can anyone tell me what configurations we could check to explain how this happened?
Unfortunately, I do not have a Qmail or Unixbox so I cant test it myself and I don't have access to our production servers so I could really use some help.
PS. Can anyone also give me the correct term for "#company.com.ph" is it the hostName/domainName?
Checks Done
1) According to the administrator - "defaultdomain" is set to "mail.company"
Yes by default qmail will add defaultdomain to any recipient address missing the domain part.
#company.com.ph is the domain name part of the email address.
defaultdomain file by default is in /var/qmail/control directory as from documentation: http://www.lifewithqmail.org/lwq.html#config-files

mvc3 routing with 2 different domains

I've developed a multi-culture app in mvc3. I have a table that holds a domain list (currently 2 records):
www.mydomain.com -> en-US
www.mydomain.pl -> pl-PL
My app dynamically checks which domain you're coming from and then sets the CurrentCultureUI depending on the domain. This works fine on my localhost as I've also added these domains to my host file, however i'm not sure how I would handle this on the live envirenment?? (yes i did purchase both domains already) any ideas?
EDIT:
I've purchased a '.com' domain AND Hosting from godaddy AND another '.pl' domain from a different registrar (home.pl). I've uploaded my site to the godaddy but the 'pl' version doesn't work. Now, when i go to my domain mngr for '.pl' domain i have an option to "use other host" and text boxes for "DNS" and "IP". Is this what i need to do? what would i need to get from godaddy? to 'home.pl' domain configuration??
I'm not see any problem if it's work locally with hosts file.
In real life no difference because host file replace DNS records in real world.
Point your real domains to same IP address.
Easy for support future domains point .com to IP address and in other domains add CNAME to .com domain. In this case if your IP address was changed you need change only DNS records in .com domain.
First, you need to get the public IP address of your hosted GoDaddy server. Next, you need to select 'Use other host' and enter that public IP address as the IP address for your 'pl' domain name.
After you have done this, you must go into your hosted GoDaddy server, and run IIS Manager. How you proceed will depend on whether the hosted server is running IIS 6, or IIS 7+.
For IIS6, you would select your site, right-click and choose 'Properties', make sure the 'Web Site' tab is selected, then you would click the 'Advanced' button next to the 'IP address' box. In the 'Advanced Web Site Identification' window, in the 'Multiple identities for this Web site' section, you would click 'Add', enter 80 for the TCP port, and enter your .pl domain name in the 'Host header value' box. Click 'OK' to close each window, until you are back at the main IIS Manager window.
For IIS7+, you can follow the directions at http://technet.microsoft.com/en-us/library/cc731692(WS.10).aspx
Once you have added the binding for your 'pl' domain name on the hosted server, and after the DNS change to point your 'pl' domain name to the hosted server propagates, everything should work as it did on your development server.
counsellorben
You need to point the .pl name to your site at .com.
You do this with a CNAME record at www.mydomain.pl pointing to www.mydomain.com.
Don't forget the period at the end. It's important in CNAME-records.
Ok, finally got it working. this is my solution (counsellorben pointed me in the right direction to get this solved)
Solution:
1) Log on to your godaddy account -> my products -> domain manager -> DNS manager ->
you will get a list of your domains.
On top you will notice 3 buttons: "Renew", "Upgrade", "Offsite". Click "Offsite" -> Add new Off-site -> for domain name enter your domain name purchased at third party domain service (in my case it was: "myawesomedomain.pl"). DO NOT check off "This domain will be transferred if you do not want it transferred (currently godaddy doesn't support European domains).
In the popup box you will also notice two nameservers listed. Write these down for later step.
Nameservers:
mns01.domaincontrol.com
mns02.domaincontrol.com
Once you've created an off-site domain click on "Edit zone" link below it. Once there enter the following info:
A (Host): Host: # | Points to: IP address of your .COM domain/hosted by godaddy (myawesomedomain.com)
CNAME (Alias): Host: www | Points to: #
2) While still on godaddys website go to "My products" -> Hosting -> click on your '.COM' hosting service -> Launch -> You should be in "Hosting dashboard":
Click on "settings" -> Domain Management -> click "Add Domain" and enter your european domain name (in my case it was "myawesomedomain.pl"). So now in domain manager I would see two domains listed:
myawesomedomain.com
myawesomedomain.pl (newly added domain)
3) Now log in to your third party domain service and point your domain (in
my case 'myawesomedomain.pl') to godaddy's default hosting nameservers. In my case
I had to log in to home.pl -> configure domain -> "Use external DNS
server". Enter the following for DNS1 and DNS2:
a. mns01.domaincontrol.com
b. mns02.domaincontrol.com
The change should propagate within 24 hours.
Thanks

Active Directory and Network ID

I know that I can get the fully qualified domain name by using the windows NT network domain. I'd like to do the reverse:
Ex: User.Identity.Name = "slaterock\fflintstone";
Active Directory returns fully qualified domain name of slaterock.bedrock.us.com.
I would like to be able to get the domain portion of User.Identity.Name by querying Active Directory (LDAP) by that user. I would be using the user's email address:
(&(objectClass=user)(objectCategory=Person)(mail=fred.flintstone#slaterock.com))
I have no trouble returning the AD attributes, but I cannot figure out an absolute link between the attributes I have and the domain name returned in User.Identity.Name. I see parts of it in the domain components (DC=slaterock,DC=bedrock,DC=US,DC=blah,blah) but I need the direct link.
Thanks
First, a bit of terminology to be clear (and to help any searches you do):
the 'slaterock' in 'slaterock\fflintstone' is the NetBIOS Domain Name for the domain.
'DC=slaterock,DC=bedrock,DC=US,DC=blah,blah' is the defaultNamingContext for the domain.
CN=fred flinstone,OU=Quarry1,DC=slaterock,DC=bedrock,... is the user account's distinguishedName.
To translate from the user's distinguishedName to the NetBIOS Domain Name of their domain:
get the user account's distinguishedName and chop it up to get the defaultNamingContext.
Then do a search against the container: "CN=Partitions,CN=Configuration,DC=JohnLewis,DC=co,DC=uk"
for an object with an nCName value that matches the defaultNamingContext from above.
Get the nETBIOSName attribute of that object and you've got what you're after.

Resources