How to switch off StartTLS in MailBee.NET SMTP object
We are using critsend's SMTP servers for our newsletters. Using the standard .NET SmtpClient with System.Net.NetworkCredential works, but we can't make it work with MailBee's SmtpServer object.
The following code fails because the server answers "The server does not support STARTTLS (STLS for POP3) command.":
SmtpServer smtpServer = new SmtpServer("smtp.critsend.com");
smtpServer.Port = 587;
smtpServer.AccountName = "MY NAME";
smtpServer.Password = "MY PASSWORD";
Smtp.LicenseKey = "MY KEY";
Smtp smtp = new Smtp();
smtp.SmtpServers.Add(smtpServer);
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("MY开发者_如何学JAVA EMAIL");
mailMessage.Subject = "Test";
mailMessage.From.Email = "MY EMAIL";
smtp.Message = mailMessage;
smtp.Send();
Setting smtpServer.SslMode = SslStartupMode.Manual doesn't help. How can I turn off StartTLS?
We are using MailBee.NET.5.5.2.138.
Any help is greatly appreciated.
According to the docs the following should work:
smtpServer.SslMode = UseStartTlsIfSupported;
After long trial and error sessions we finally came up with the solution. The following property has to be added to the SmtpServer:
smtpServer.AuthMethods = AuthenticationMethods.SaslPlain;
精彩评论