同样的代码,我如果把邮箱都换成是163的就能,换成126的就发不出去
大家看看我哪里错了
MailMessage MailObj=new MailMessage();
MailObj.From="[email protected]";
MailObj.To="[email protected]";
MailObj.Subject="帮您找回密码";
MailObj.Body="<html><body><P>"+"aaaaaaaaaa"+"您好:</P><P> 您注册的会员密码是"+"bbbbbbbbbbb"+",感谢您的关注!</P><P> <STRONG>**客服</STRONG></P></body></html>";
MailObj.BodyFormat=MailFormat.Html;//设置电子邮件正文的内容类型为 HTML格式 MailObj.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //表示基本验证
MailObj.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/sendusername", "[email protected]");
MailObj.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/sendpassword", "***");
SmtpMail.SmtpServer = "smtp.126.com"; //邮件服务器地址
try
{
SmtpMail.Send(MailObj);
}
catch
{
Response.Write("<script>window.alert('"+"发生故障,邮件没有发送成功,您可以选择其它方式和我们联系!"+"')</script>");
return;
}
Response.Write("<script>window.alert('"+"密码已经成功发送到您注册的邮箱,!"+"')</script>");
大家看看我哪里错了
MailMessage MailObj=new MailMessage();
MailObj.From="[email protected]";
MailObj.To="[email protected]";
MailObj.Subject="帮您找回密码";
MailObj.Body="<html><body><P>"+"aaaaaaaaaa"+"您好:</P><P> 您注册的会员密码是"+"bbbbbbbbbbb"+",感谢您的关注!</P><P> <STRONG>**客服</STRONG></P></body></html>";
MailObj.BodyFormat=MailFormat.Html;//设置电子邮件正文的内容类型为 HTML格式 MailObj.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //表示基本验证
MailObj.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/sendusername", "[email protected]");
MailObj.Fields.Add(@"http://schemas.microsoft.com/cdo/configuration/sendpassword", "***");
SmtpMail.SmtpServer = "smtp.126.com"; //邮件服务器地址
try
{
SmtpMail.Send(MailObj);
}
catch
{
Response.Write("<script>window.alert('"+"发生故障,邮件没有发送成功,您可以选择其它方式和我们联系!"+"')</script>");
return;
}
Response.Write("<script>window.alert('"+"密码已经成功发送到您注册的邮箱,!"+"')</script>");
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货