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);
}