使用System.Web.Mail 发邮件出错!
MailMessage message1 = new MailMessage();
message1.BodyFormat = MailFormat.Html;
message1.Priority = MailPriority.High;
message1.Subject = "Test";
message1.From = "test@163.com";
message1.To = "test1@163.com";
message1.Body = "welcome";
message1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
message1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","test");
message1.Fields.Add(" http://schemas.microsoft.com/cdo/configuration/sendpassword","test");
SmtpMail.SmtpServer = "smtp.163.com";
SmtpMail.Send(message1);
错误提示:
邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: 邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available
Source Error:
Line 59: message1.Fields.Add(" http://schemas.microsoft.com/cdo/configuration/sendpassword","666666");
Line 60: SmtpMail.SmtpServer = "smtp.163.com";
Line 61: SmtpMail.Send(message1);
Line 62: }
Line 63: }