为什么发送邮件出现这样的错误(ASP.NET web service)??
出现的错误提示是:
邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available
代码如下:(用户名和密码都是正确,能登陆邮箱的)
public delegate string mail(string email, string content);
public string sendMail(string email, string content)
{
System.Web.Mail.MailMessage myMail = new System.Web.Mail.MailMessage();
myMail.From = "lyfbhn@163.com ";
myMail.To = email;
myMail.Subject = "MailTest ";
myMail.Body = content;
myMail.BodyFormat = MailFormat.Html;
myMail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpserverport ", " 25 ");
myMail.Fields.Add ( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ", "1 ");
myMail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ", "lyfbhn@163.com ");
myMail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ", "***** ");
SmtpMail.SmtpServer = "smtp.163.com ";
//SmtpMail.SmtpServer = "221.130.189.148 "; //your smtp server here
SmtpMail.Send(myMail);
return "成功 ";
}
public class MyState
{
public string email;
public string content;
&nb