为什么有的SMTP服务器可以发邮件而有的不可以?
左直拳
博客专家认证 2006-05-31 02:54:34 同样的一段代码,有的SMTP服务器可以发邮件而有的就不行。
代码如下:
MailMessage objMail = new MailMessage();
objMail.From = showName + "<" + fromMail + ">";
objMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
objMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = userName;
objMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = password;
objMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
objMail.Fields["http://schemas.microsoft.com/cdo/configuration/languagecode"] = 0x0804;
objMail.To = toMail;
objMail.Subject = title;
objMail.Body = content;
objMail.BodyFormat = format;
objMail.Priority = MailPriority.Normal;//优先级
objMail.BodyEncoding = Encoding.UTF8;
SmtpMail.SmtpServer = smtpserver;
SmtpMail.Send(objMail);
对于163.com,tom.com,21cn.net这样的著名邮箱,发送没有问题;但如果用公司租用的企业邮箱(中国万网的,邮箱后缀使用公司自己的域名)就不行。
错误提示:
邮件无法发送到 SMTP 服务器。传输错误代码为 0x800ccc6a。服务器响应为
451 Requested action aborted: local error in processing
怀疑是不是企业邮箱所在的SMTP服务器做了什么限制,可是用outlook发送又没问题,配置也与163、21cn的没什么两样。
谁能告诉俺?