我可以使用Gmail发送电子邮件,但现在我想使用我的域名发送电子邮件
以下是用于使用我的域
发送电子邮件的代码但面临访问被拒绝的问题
SmtpClient client = new SmtpClient();
client.Host = "mail.xyz.com";
client.Port = 25;
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("xxxx@xxxx.org", "xxxx");
client.DeliveryMethod = SmtpDeliveryMethod.Network;
MailMessage maili = new MailMessage();
maili.Body = password;
maili.Subject = "Password Reset Confirmation";
maili.IsBodyHtml = true;
maili.From = new MailAddress("xxxx@xxxx.org");
maili.To.Add(email);
try
{
ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
};
client.Send(maili);
}
catch (Exception ex)
{
throw ex;
}
提前致谢