0

I have purchased domain from GoDaddy But site hosted in azure app service. I am trying to send mail using the business email created under the domain(xyz@domain.com). But facing error while sending using smtp rely, Is there any changes need in GoDaddy DNS ?

            SmtpClient client = new SmtpClient()
            {
                Host = "smtp.office365.com",
                EnableSsl = false,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential("xyz@domain.com", "password"),
                Port = 587
            };

Getting below error , The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [DM5PR0101CA0014.prod.exchangelabs.com]

1 Answers1

0

Make sure that NetworkCredentials you set are correct. For example in your case since it was office SMTP, user id had to be used in the NetworkCredential along with domain name and not only domain name.

Credentials = new NetworkCredential("username", "password","xyz@domain.com")

For more details, you could refer to this SO thread.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30