我正在使用以下基本代码:
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.to.add("someone@hotmail.com");
msg.to.add("someone@gmail.com");
msg.to.add("someone@myDomain.com");
msg.From = new MailAddress("me@myDomain.com", "myDomain", System.Text.Encoding.UTF8);
msg.Subject = "subject";
msg.SubjectEncoding = System.Text.Encoding.UTF8;
msg.Body = "body";
msg.BodyEncoding = System.Text.Encoding.UTF8;
msg.IsBodyHtml = false;
//Add the Creddentials
SmtpClient client = new SmtpClient();
client.Host = "192.168.0.24";
client.Credentials = new System.Net.NetworkCredential("me@myDomain.com", "password");
client.Port = 25;
try
{
client.Send(msg);
}
catch (System.Net.Mail.SmtpException ex)
{
sw.WriteLine(string.Format("ERROR MAIL: {0}. Inner exception: {1}", ex.Message, ex.InnerException.Message));
}
问题是邮件仅发送到我的域中的地址(someone@mydomain.com),并且我得到以下 2 个其他地址的异常:
System.Net.Mail.SmtpFailedRecipientException:邮箱不可用。服务器响应为:此位置没有此类域
我怀疑这与阻止我的 smtp 客户端有关,但不知道如何解决这个问题。任何的想法?谢谢!