MailMessage mail = new MailMessage();
mail.From        = "[email protected]";
mail.To          = "[email protected]";
mail.Subject     = this.TextBox1 .Text +this.DropDownList1 .SelectedItem .Text +"宾馆回答";
mail.Body        = "祥情见附件";
mail.BodyFormat  = MailFormat.Html;
mail.Attachments .Add (new MailAttachment(file));

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication 
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "yha77"); //set your username here 
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "yha77"); //set your password here 

SmtpMail.SmtpServer = "mail.ntachina.com";
SmtpMail.Send(mail);
请问:为什么报错:The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available

解决方案 »

  1.   

    我现在头疼的问题是如何操作Exchange
      

  2.   

    jmail发送有件的函数public Boolean sendmail(string from,string smtp,string username,string pass,string aim,string title,string content)
    {

    jmail.Message jmailobj=new jmail.Message();
    jmailobj.Logging=true;
    jmailobj.Silent=true;
    jmailobj.MailServerUserName=username; //发信邮件服务器的帐号
    jmailobj.MailServerPassWord=pass; //密码
    jmailobj.Body=content;
    jmailobj.Charset="gb2312"; 
    jmailobj.Subject=title;
    jmailobj.From=from;
    jmailobj.FromName="test";
    jmailobj.AddRecipient(aim,"Name","A"); //收件人地址
    jmailobj.Priority =1;
    if(jmailobj.Send(smtp,false)) 
    {
    //Response.Write("ok"); 
    return true;
    }
    else 
    {
    return false;
    }
    }
    #endregion
      

  3.   

    http://www.cnblogs.com/jzywh/archive/2005/06/09/170783.html
    http://blog.joycode.com/ghj/archive/2004/10/22/36274.aspx
    第一要配置SMTP服务,第一个网址里有
    第二是关于杀毒软件的,因为有的杀毒软件会屏蔽掉25端口,第二个网址上有解释,
    你可以把杀毒软件先关闭掉
    看看是不是上面的两个原因
      

  4.   

    无奈,解决不了,只好将SmtpMail.SmtpServer = "mail.ntachina.com";删除,还能行散分