0
第三方连接到邮件服务器,如果我通过托管服务提供商诸如A2 Hosting第三方托管一个asp.net应用程序的核心是可以利用这个来发送邮件瓦特/邮件套件?我已经尝试了很多不同的东西和client.Connect只是挂起,并最终抛出异常。 Ex为空。使用MailKit从托管服务提供商
这里是我的代码:
using (var client = new SmtpClient())
{
// For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
client.Connect("mail.mydomain.com", 25, false);
// Note: since we don't have an OAuth2 token, disable
// the XOAUTH2 authentication mechanism.
client.AuthenticationMechanisms.Remove("XOAUTH2");
// Note: only needed if the SMTP server requires authentication
client.Authenticate("[email protected]", "PASSWORD");
client.Send(message);
client.Disconnect(true);
}