Mail : Office 365

  • Thread starter Thread starter Bre-x
  • Start date Start date
B

Bre-x

Guest
Hello,

I get the following error :

The SMTP server requieres a secure connection or the client was not authenticated
The server response was : 5.7.57 SMPT
Client was not authenticated to send anonymous mail during MAIL FROM

I tried different smpt

smtp.mydomain.com, the MX record, smtp.office365.com, no luck

Emails are correct and their password, no luck

Please help,

Dim msg As MailMessage = New MailMessage()
msg.[To].Add(New MailAddress("myemail.com", "My Name"))
msg.From = New MailAddress("myemail.com", "My Name")
msg.Subject = "This is a Test Mail"
msg.Body = "This is a test message"
msg.IsBodyHtml = True
Dim client As SmtpClient = New SmtpClient()
client.Port = 587
client.UseDefaultCredentials = False
client.EnableSsl = True

client.Host = "smtp.office365.com"
client.DeliveryMethod = SmtpDeliveryMethod.Network
client.Credentials = New System.Net.NetworkCredential("myemail.com", "mypass")

Try
client.Send(msg)
MessageBox.Show("Message Sent Succesfully")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

Continue reading...
 
Back
Top