MailKit C# SmtpClient.Connect() to Office 365 generating exception: "An existing connection was forcibly closed by the remote host"
MailKit C# SmtpClient.Connect() to Office 365 generating exception: "An existing connection was forcibly closed by the remote host"
MailKit C# SmtpClient.Connect() to Office 365 generating exception: "An existing connection was forcibly closed by the remote host"
Re: MailKit C# SmtpClient.Connect() to Office 365 generating exception: "An existing connection was forcibly closed by the remote host"
Got another error after posting this question which led me to the answer:
Handshake failed due to an unexpected packet format
The solution is to connect to Office 365 like this instead:
```
smtpClient.Connect("smtp.office365.com", 587, SecureSocketOptions.StartTls);
```
Handshake failed due to an unexpected packet format
The solution is to connect to Office 365 like this instead:
```
smtpClient.Connect("smtp.office365.com", 587, SecureSocketOptions.StartTls);
```