我的邮箱位于fatcow Open Xchange服务器下。
我想从mymail@mywebsite.com
向user@mywebsite.com
发送电子邮件。
为此,我的代码如下:
SmtpClient smtpClient = new SmtpClient("smtp.mywebsite.com", 587);// Setting smtp client with port no, smtp server name(getting from mail central)
smtpClient.Credentials = new System.Net.NetworkCredential("mymail@mywebsite.com", "password");//setting network credential
smtpClient.UseDefaultCredentials = true;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.EnableSsl = true;
MailMessage mail = new MailMessage();
//Setting From , To
mail.From = new MailAddress("mymail@mywebsite.com", "My NAme(sender name)");
mail.To.Add(new MailAddress("user@mywebsite.com");
//To bypass the certificate validation
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object s,
System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Security.Cryptography.X509Certificates.X509Chain chain,
System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true;
};
smtpClient.Send(mail);
这显示错误
邮箱不可用。服务器响应为:walauthsmtp11:主机202.142.81.4:未允许未经身份验证的中继
所以有人可以帮助我吗?