Mailkit: Office 365 SSL

Created on 2 Aug 2019  路  1Comment  路  Source: jstedfast/MailKit

Describe the bug
Using SmtpClient.Connect( "smtp.office365.com", 587, true) does not work in the case of 365, and needs to be explicitly used as: SmtpClient.Connect( "smtp.office365.com", 587, SecureSocketOptions.StartTls).

To Reproduce
Use Connect( "smtp.office365.com", 587, true);

Expected behavior
Connecting to the smtp server (understanding by itself office 365 uses STL and not SSL).

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: windows 10
  • Browser chrome (not really relevent i think but...)
  • Version 75.0.3770.142 (not really relevent i think but...)

Additional Note
The exception that is being throwen is:
MailKit.Security.SslHandshakeException: 'An error occurred while attempting to establish an SSL or TLS connection. One possibility is that you are trying to connect to a port which does not support SSL/TLS. The other possibility is that the SSL certificate presented by the server is not trusted by the system for one or more of the following reasons:

  1. The server is using a self-signed certificate which cannot be verified.
  2. The local system is missing a Root or Intermediate certificate needed to verify the server's certificate.
  3. The certificate presented by the server is expired or invalid.

See https://github.com/jstedfast/MailKit/blob/master/FAQ.md#InvalidSslCertificate for possible solutions.'

Aditonal Context
This is not a big bug, but i tought it would be good to point it out here so maybe it will be fix :)
a google search would find the fix pretty fast : https://stackoverflow.com/questions/41872812/mailkit-c-sharp-smtpclient-connect-to-office-365-generating-exception-an-exi (first search result for "mailkit with office 365")

question

Most helpful comment

This isn't a bug.

The bool useSsl argument is for port 465 only because it tells MailKit to use an SSL-wrapped connection which is entirely different from STARTTLS.

>All comments

This isn't a bug.

The bool useSsl argument is for port 465 only because it tells MailKit to use an SSL-wrapped connection which is entirely different from STARTTLS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atiqi36 picture atiqi36  路  7Comments

syneex picture syneex  路  4Comments

wayneguow picture wayneguow  路  5Comments

dbogatov picture dbogatov  路  7Comments

rgmills picture rgmills  路  6Comments