Извините за отсутствие информации, мой демонстрационный код
var smtpServer = new SmtpServer()
{
Name = "smtp.office365.com",
AccountName = "my account",
Password = "my password",
Port = 587
};
smtpServer.SslMode = MailBee.Security.SslStartupMode.UseStartTls;
smtpServer.SslProtocol = MailBee.Security.SecurityProtocol.Auto;
smtpServer.AuthMethods = MailBee.AuthenticationMethods.Auto;
var smtp = new Smtp("key");
smtp.SmtpServers.Add(smtpServer);
smtp.Message.Builder.HtmlToPlainMode = MailBee.Mime.HtmlToPlainAutoConvert.IfHtml;
smtp.Message.XMailer = "Testing tool";
smtp.Message.Charset = "utf8";
smtp.Connect();
smtp.Hello();
smtp.Login();
Файл журнала Mailbee:
[01:54:37.88] [INFO] Assembly version: 11.2.0 build 590 for .NET Core 2.0.
[01:54:37.88] [INFO] Will resolve host "smtp.office365.com".
[01:54:37.94] [INFO] Host "smtp.office365.com" resolved to IP address(es) 40.100.54.226, 40.100.54.18, 52.98.85.194, 52.98.77.98, 2603:1046:c02:1820::2, 2603:1046:201:16::2, 2603:1046:202::2, 2603:1046:202:1::2.
[01:54:37.94] [INFO] Will connect to host "smtp.office365.com" on port 587.
[01:54:37.98] [INFO] Socket connected to IP address 40.100.54.226 on port 587.
[01:54:38.01] [RECV] 220 HK2PR02CA0150.outlook.office365.com Microsoft ESMTP MAIL Service ready at Sat, 7 Mar 2020 01:53:58 +0000\r\n
[01:54:38.02] [INFO] Connected to mail service at host "smtp.office365.com" on port 587 and ready.
[01:54:38.02] [INFO] Will send Hello command (HELO or EHLO).
[01:54:38.02] [SEND] EHLO [172.17.0.28]\r\n
[01:54:38.05] [RECV] 250-HK2PR02CA0150.outlook.office365.com Hello [103.53.91.136]\r\n250-SIZE 157286400\r\n250-PIPELINING\r\n250-DSN\r\n250-ENHANCEDSTATUSCODES\r\n250-STARTTLS\r\n250-8BITMIME\r\n250-BINARYMIME\r\n250-CHUNKING\r\n250 SMTPUTF8\r\n
[01:54:38.06] [INFO] SMTP Hello completed.
[01:54:38.06] [INFO] Notify server that we are ready to start TLS/SSL negotiation.
[01:54:38.06] [SEND] STARTTLS\r\n
[01:54:38.09] [RECV] 220 2.0.0 SMTP server ready\r\n
[01:54:38.11] [INFO] Will start TLS/SSL negotiation sequence.
[01:54:38.36] [INFO] TLS/SSL negotiation completed.
[01:54:38.36] [INFO] Will send Hello command (HELO or EHLO).
[01:54:38.36] [SEND] EHLO [172.17.0.28]\r\n
[01:54:38.39] [RECV] 250-HK2PR02CA0150.outlook.office365.com Hello [103.53.91.136]\r\n250-SIZE 157286400\r\n250-PIPELINING\r\n250-DSN\r\n250-ENHANCEDSTATUSCODES\r\n250-AUTH LOGIN XOAUTH2\r\n250-8BITMIME\r\n250-BINARYMIME\r\n250-CHUNKING\r\n250 SMTPUTF8\r\n
[01:54:38.39] [INFO] SMTP Hello completed.
[01:54:38.40] [INFO] Will login as "my Office365 account".
[01:54:38.40] [INFO] Will try SASL LOGIN authentication method.
[01:54:38.41] [SEND] AUTH LOGIN ********\r\n
[01:54:38.44] [RECV] 334 UGFzc3dvcmQ6\r\n
[01:54:38.44] [SEND] ********\r\n
[01:54:40.66] [RECV] 235 2.7.0 Authentication successful\r\n
[01:54:40.66] [INFO] Logged in as "my Office365 account".
[01:54:40.67] [SEND] QUIT\r\n
[01:54:40.77] [RECV] 221 2.0.0 Service closing transmission channel\r\n
[01:54:40.91] [INFO] Error: SocketException occurred. InnerException message follows: Connection reset by peer
[01:54:40.91] [INFO] Will disconnect from host "smtp.office365.com".
[01:54:40.91] [INFO] Disconnected from host "smtp.office365.com".