I know there are various thread out there related to this problem but i was unable to take any of the responses on those thread and make it work on my server.
So let try to see if someone can help me out here. 99% of the emails go out properly and few actually return with that error.
My code looks like this
MailMessage mm = new MailMessage(Settings.EmailCustomerService, to, subject, body);
mm.SubjectEncoding = Encoding.UTF8;
mm.BodyEncoding = Encoding.UTF8;
mm.IsBodyHtml = true;
MailAddress add = new MailAddress(Settings.EmailCustomerService, "Customer Service");
mm.From = add;
try
{
SmtpClient client = new SmtpClient(Settings.EmailSMTP);
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(Settings.EmailUser, Settings.EmailPwd);
System.Threading.ParameterizedThreadStart threadStart = new System.Threading.ParameterizedThreadStart(SendInThread);
threadStart.Invoke(new SendInThreadParams
{
client = client,
Message = mm
});
}
finally
{
mm = null;
}
Actually the Credentials code was added later but my code was run OK even without it. It just happen that 1% of the email never make it to the recipients and adding those 2 lines for Credentials did not make a difference.
The Settings.EmailUser is just a user on the server where the SMTP runs, but i have NOT attach it to nowhere.
I bet that's the problem.
The SMTP Server Relay is set to use 127.0.0.1 and the FQDN is just the name of the machine (something like "Machine1" ...nothing with a domain.com name)
The error I'm getting is this
Reporting-MTA: dns;Machine1
Received-From-MTA: dns;Machine1
Arrival-Date: Wed, 30 May 2012 23:08:36 -0700
Final-Recipient: rfc822;test@email.net
Action: failed
Status: 5.5.0
Diagnostic-Code: smtp;550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)
Return message emailed back was:
> This is an automatically generated Delivery Status Notification.
Delivery to the following recipients failed.
test@email.com
Thanks in advanced...