I am using Office365 web app SMTP to send email from Asp.Net but Its always throwing following error!
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated at System.Net.Mail.MailCommand.CheckResponse
The web.config is given below - with username & password changed
<network enableSsl="true" host="pod51007.outlook.com" userName="XXXX" password="XXXXX" port="587" defaultCredentials="false" />
I had the same problem and solved so:
Dim client As SmtpClient = New SmtpClient()
client.Credentials = New System.Net.NetworkCredential("your user", "your password")
client.Port = 587
client.Host = "smtp.office365.com"
important are this instruction, without them is not working :
client.UseDefaultCredentials = False
client.DeliveryMethod = SmtpDeliveryMethod.Network
client.EnableSsl = True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With