C#无法从客户端PC和iPad发送邮件:550访问被拒绝->无效的HELO名称

时间:2018-12-14 23:18:13

标签: c# email smtpclient

在我的办公室,无论是在PC还是iPad上,都可以正常工作。但是在客户办公室却给了我:550访问被拒绝->无效的HELO名称

我尝试了UseDefaultCredentials和SSL的不同组合以及不同的端口号,但到目前为止还算不上成功。发件人的电子邮件地址和密码在我的办公室与客户办公室相同。

代码如下:

MailMessage mail = new MailMessage();

mail.From = new MailAddress("noreply@aeonvirtual.com");
mail.To.Add("somebody@somewhere.com");
mail.Subject = "blabla";
mail.Body = "this is a body";

SmtpClient smtpServer = new SmtpClient("mail.myserver.com");
smtpServer.Port = port;
smtpServer.UseDefaultCredentials = useDefaultCredentials;
smtpServer.Credentials = new System.Net.NetworkCredential("noreply@myserver.com", "mypassword") as ICredentialsByHost;
smtpServer.EnableSsl = useSSL;

ServicePointManager.ServerCertificateValidationCallback =
     delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

smtpServer.Send(mail);   

0 个答案:

没有答案