try
{
jmail.MessageClass MyMail=new jmail.MessageClass();
MyMail.Charset = "GB2312";// 字符集
MyMail.Encoding = "BASE64";//附件的编码格式
MyMail.ContentType = "text/html";
MyMail.ISOEncodeHeaders = false;//信头编码iso-8859-1字符集
MyMail.Priority = Convert.ToByte(1);//优先级
MyMail.From = "[email protected]";//发送人邮件地址
MyMail.FromName = "al";//发送人姓名
MyMail.Subject = "test";// 邮件主题
MyMail.MailServerUserName = "sendmail";//身份验证用户名
MyMail.MailServerPassWord = "sendmail";//用户密码
MyMail.AddRecipient("[email protected]","","");//收件人邮箱
MyMail.Body = "nihao";//邮件内容
if (MyMail.Send("192.168.0.18",false))
{
Response.Write("<script>alert('发送成功!');</script>");
}
else
{
Response.Write("<script>alert('发送失败!');</script>");
}
MyMail.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}为什么,if (MyMail.Send("192.168.0.18",false)) 就出现The message was undeliverable. All servers failed to receive the message 错误了

解决方案 »

  1.   

    jmail.Message Jmail = new jmail.Message();
    String Subject = "新用户注册通知";
    String body = "欢迎";
    String FromEmail = "";
    String ToEmail = strRC_Mail;
    Jmail.Silent = false;//Silent属性:如果设置为true,JMail不会抛出例外错误. JMail. Send( () 会根据操作结果返回true或false
    Jmail.Logging = false;
    Jmail.Charset = "GB2312";
    Jmail.ContentType = "text/html";
    Jmail.AddRecipient(ToEmail, "", "");
    Jmail.From = FromEmail;
    Jmail.MailServerUserName = "";
    Jmail.MailServerPassWord = "";
    Jmail.Subject = Subject;
    Jmail.Body = body.ToString();
    Jmail.Send("smtp.qq.cn", false);
    Jmail.Close();发不出去可能的问题你可以利用Silent来获取看是哪里的错。不要给我分,我这号不要分。
      

  2.   

    Jmail.Send("smtp.qq.cn", false)肯定这步有问题
      

  3.   

    MyMail.Send 你是要发送你之前创建的MessageClass对象
      

  4.   

    恩 但这肯定出先问题了
    提示 The message was undeliverable. All servers failed to receive the message 错误
      

  5.   

    估计是你的邮件服务器(192.168.0.18)的问题,试试用别的邮件服务器发发看看如:tom,126,qq,163...
      

  6.   

    LSD 我都用了,就是还是那个问题jmail.MessageClass MyMail=new jmail.MessageClass();
    //jmail.Message MyMail = new jmail.Message();
    MyMail.ContentType="text/html";
    MyMail.Silent=false;
    MyMail.Logging=true;
    MyMail.Charset="GB2312";    
    MyMail.AddRecipient("[email protected]","","");
    MyMail.From="[email protected]";
    MyMail.MailServerUserName="123456";//
    MyMail.MailServerPassWord="123456";//
    MyMail.Subject="主题";
    MyMail.Body="内容";
    MyMail.Send("smtp.126.com",false);
    this.labTest.Text="3";
    MyMail.Close() 这么写 还是上面的错误
      

  7.   

    设置为true看看
    http://www.cnblogs.com/ilcw/articles/1237425.html
    http://topic.csdn.net/u/20070524/10/253f356d-2211-484c-9ce5-29b4f37d40f5.html