MailMessage message1 = new MailMessage();
message1.BodyFormat = MailFormat.Html;
message1.Priority = MailPriority.High;
message1.Subject = "Test";
message1.From = "[email protected]";
message1.To = "[email protected]";
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: }
message1.BodyFormat = MailFormat.Html;
message1.Priority = MailPriority.High;
message1.Subject = "Test";
message1.From = "[email protected]";
message1.To = "[email protected]";
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: }
解决方案 »
- 新建vs2005网站项目出现隐藏代码
- 如何在FrontPage中改变DataList显示长度?
- 用session和web.config的配置做身份验证哪个好?大家都是用哪个?
- <option value="330000">浙江省</option> this.options[this.selectedIndex].Value;只能得到330000 我想得到浙江省 该怎么做?
- .NET 2003中如何打开现有网站
- 问一个问题解决后立即结帖!
- 请问怎么将Datagrid显示为两列?
- 高手指点一下ViewState报错了
- 如何显示数据库中表的结构
- 向asp编程高手请教的一个问题
- asp.net 服务器端控件调用javascript代码
- js + css 问题
{ MailMessage mailObj = new MailMessage();
// 设置email的'from'和'to'的地址
mailObj.From =mail.MailFrom;
mailObj.To =mail.MailTo;
mailObj.Subject =mail.MailSubject;
mailObj.Body =mail.MailBody;
System.Web.Mail.MailEncoding enc=new MailEncoding();
enc=MailEncoding.Base64;
MailAttachment att=new MailAttachment(mail.Attachments,enc);
mailObj.Attachments.Add(att) ;
// 使用SmtpMail对象来发送邮件。
SmtpMail.SmtpServer=mail.stmpserver;
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",mail.login);
//密码
mailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",mail.pwd);
SmtpMail.Send(mailObj);
}
public class mailobject
{
public string MailFrom;
public string MailTo;
public string MailSubject;
public string MailBody;
public string MailFormat;
public string mformat;//对邮件进行加密
public string Attachments;//附件
public string stmpserver;
public string login;
public string pwd;
public string email_to;}