SmtpClient with TLS1.2 issue: the server response was 5.7.3 starttls is required to send mail

  • Thread starter Thread starter Alpaca H
  • Start date Start date
A

Alpaca H

Guest
Hi,

I having issue while sending email using SmtpClient with TLS 1.2 protocol.

Below are the info:
Type: SMTP
Host: smtp.office365.com
Port: 587
Protocol: TLS 1.2

Code:

// SMTP Client
SmtpClient smtpClient = new SmtpClient("smtp.outlook365.com", 587);
smtpClient.EnableSsl = false;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential(emailAddress, password);

// Mail Message
MailMessage message = new MailMessage();
message.From = new MailAddress(emailAddress);
message.To.Add(recipient);
message.Subject = "Test Email";
message.IsBodyHtml = true;
message.Body = "<p>Test Email</p>";

// Send Mail
smtpClient.Send(message);

With the code above, i get error: the server response was 5.7.3 starttls is required to send mail.

Please help.

Thank you.

Continue reading...
 
Back
Top