Hello,
I am getting the following SMTP Authentication error message, when I am trying to send an email using the following C# script:
Error: The server response was: 5.7.1 Unable to relay
So I did some search and the conclusion is that I also need to specify the smtp username and password for authentication.
How can this be achieved
Thanks in advance.
I am getting the following SMTP Authentication error message, when I am trying to send an email using the following C# script:
Error: The server response was: 5.7.1 Unable to relay
Code:
private void send_emails()
{
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add("recepient@test.com");
message.Subject = "Test Subject";
message.From = new System.Net.Mail.MailAddress("sender@test.com");
message.Body = "Test Body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.servername.com");
smtp.Send(message);
}
So I did some search and the conclusion is that I also need to specify the smtp username and password for authentication.
How can this be achieved
Thanks in advance.