日期:2014-05-17  浏览次数:20921 次

.net 2.0 发送tom邮箱不成功...HELP!~
MailMessage mail = new MailMessage();
  mail.From = new MailAddress("NameFrom@tom.com");
  mail.To.Add("NameSend@163.com");
   
  mail.Subject = "This is an email";
  mail.Body = "this is the body content of the email.";
   
  SmtpClient smtp = new SmtpClient("smtp.tom.com", 25);
  //smtp.EnableSsl = true;
  //smtp.UseDefaultCredentials = true;
   
  smtp.Credentials = new NetworkCredential("NameFrom", "PassWord");

  smtp.Send(mail);

错误提示:
不允许使用邮箱名称。 服务器响应为: this mail is blocked by kbas system,blockid=bjapp21.tom.com.15514.1203659604

------解决方案--------------------
会不会是他们服务器的问题吗?
------解决方案--------------------
没用过tmp.com的.
你确定它的Port是25吗?

另外,你可以试一下sohu的邮箱,是可以用的.我现在就在用,其Port是25
------解决方案--------------------
俺测试过,163也不一定能发
不过老版本的可以发送好像是2005以前吧,具体的要看163的文件了
------解决方案--------------------
这是我以前写的,用的是GMAIL的SMTP。我记得YAHOO是没问题的,Tom的不太清楚。你自己试一下。是2.0的。
你的错误会不会是防火墙的问题 
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add("xxxxx@163.com");
mail.From = new System.Net.Mail.MailAddress("abcd@gmail.com", "请收信", System.Text.Encoding.UTF8);
mail.Subject = "哈哈~";
mail.SubjectEncoding = System.Text.Encoding.UTF8;

string tablehead = "";
string tableend = "";
mail.Body = tablehead + tableend;
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true;
mail.Priority = System.Net.Mail.MailPriority.High;
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 587;
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("abcd@gmail.com", "邮箱密码");
client.Send(mail);

mail.Dispose();
client = null;