• Register
Welcome to Adminkit Q&A, where you can ask questions related to email delivery issues and receive answers from adminkit support or other members of the community.

Unable to send email using my code but your SMTP Diag tool

0 votes

Hi,

 I am using your diag tool to send the email but not with my own C# code and getting the error:

Mailbox unavailable. The server response was: Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

Following is my code:

 

  var mailMessage = new MailMessage(from, toEmailAddress, subject, emailBody);
   var smtp = new SmtpClient(smtpHost)
            {
                Credentials = new NetworkCredential(from, fromPassword),
                Port = smtpPort,
                EnableSsl = false,
                UseDefaultCredentials = false,
                DeliveryMethod = SmtpDeliveryMethod.Network
            };
            try
            {
                smtp.Send(mailMessage);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
 
All the credentails I am using are correct. I am using port 587. Can any body shed light why is it not working?
asked Jan 1, 2014 by anonymous

1 Answer

0 votes
 
Best answer

Hi,

Please find below answer (if you are using different accounts in from address and network credentials)

http://stackoverflow.com/questions/3155242/troubleshooting-mailbox-unavailable-the-server-response-was-access-denied-i

Regards,

AdminKit Support

 

 

answered Jan 1, 2014 by admin (2,920 points)
selected Jan 11, 2014 by admin
Thanks very much. I had already seen above stackoverflow post. But your comment " (if you are using different accounts in from address and network credentials)" help me out as I was using the same credentials for from and in NetworkCredentials and was also setting the UserDefaultCredentials to false. When I commented it out, it worked fine.
...