I am using ASP.NET Web forms and sending an automated email through our SMTP Emailing system. In my web.config I added this:
<mailSettings>
<smtp from="username@domain.com">
<network host="111.111.1.1" port="25" defaultCredentials="true" />
</smtp>
</mailSettings>
Now I am writing this code to send an email:
MailMessage message = new MailMessage();
message.From = new MailAddress("username@domain.com");
message.To.Add(new MailAddress("username1@domain.com"));
message.CC.Add(new MailAddress("username2@domain.com"));
message.Subject = "Testing";
message.Body = bodymessage;
SmtpClient client = new SmtpClient();
client.Send(message);
At the last line I am getting this error mesg:
{“Mailbox unavailable. The server response was: 5.7.1 Client does not
have permissions to send as this
sender”}
What is wrong here?
Perhaps there is authentication on the SMTP server? Try using