-2

i m having followingerror while sending mail with a specified domain in c# . Mailbox unavailable. The server response was: Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

its working perfectly while i am sending mail with gmail host.

Thanks in advance

1 Answers1

0

One possible cause is that the sender you are using is not the same with the sender for the email. Notice that the network credential used is the same with the mail message sender.

See this original answer in a similar problem.

string to = "receiver@domain.com";

//It seems, your mail server demands to use the same email-id in SENDER as with which you're authenticating. 
//string from = "sender@domain.com";
string from = "test@domain.com";

string subject = "Hello World!";
string body =  "Hello Body!";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient("smtp.domain.com");
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("test@domain.com", "password");
client.Send(message);
Community
  • 1
  • 1
jegtugado
  • 5,081
  • 1
  • 12
  • 35