private void Button1_ServerClick(object sender, System.EventArgs e)
{
jmail.MessageClass msg = new jmail.MessageClass(); msg.From = "[email protected]";
msg.FromName = "金勇军";

msg.AddRecipient("[email protected]",null,null);

msg.Subject  = "邮件发送程序测试";
msg.Body = "";

try
{
          msg.Send("mail.rui-cheng.com",false);           this.Response.Write("邮件发送成功!");
}
catch(System.Exception e1)
{
this.Response.Write(e1.ToString());
}
}以上程序运行后就出现以下错误信息:
System.Runtime.InteropServices.COMException (0x8000FFFF): The message was undeliverable. All servers failed to receive the message at jmail.MessageClass.Send(String mailServer, Boolean enque) at RcOA.Example.Button1_ServerClick(Object sender, EventArgs e) in d:\rcoa\example.aspx.cs:line 62
如果以上程序改程以下就不出这个问题。private void Button1_ServerClick(object sender, System.EventArgs e)
{
jmail.MessageClass msg = new jmail.MessageClass(); msg.From = "[email protected]";
msg.FromName = "金勇军";

msg.AddRecipient("[email protected]",null,null);

msg.Subject  = "邮件发送程序测试";
msg.Body = "";

try
{
msg.Send("mail.sina.com.cn",false);
this.Response.Write("邮件发送成功!");
}
catch(System.Exception e1)
{
this.Response.Write(e1.ToString());
}
}以上两个程序主要不同点是:第一个是用我们公司跟一个邮箱服务公司申请的邮箱服务器,第二个是用新浪的邮箱服务器。为什么会出现这种情况呢?

解决方案 »

  1.   

    帐号和密码的属性设置在哪里?登录SMTP是需要帐号和密码的,是因为安全原因没有写上来吗?注意了,Sina.net的SMTP服务器是为很多很多企业油箱提供服务的,所以登录名是"[email protected]",其中"AAA.BBB"是你们单位的油箱后缀,密码是这个邮箱的密码。
    而如果是其他SMTP服务器,登录名就是XXX,不需要包含"@AAA.BBB"
      

  2.   

    To:yulitian[登录SMTP是需要帐号和密码]这句话我有点不明白.为什么以上的两个程序只是邮件服务器不同,可是一个能正常发出而另一个发生错误.你能告诉第一段代码那里有错误吗?
      

  3.   

    因为一般情况下,由于SMTP服务器设置的不同,是可能可以直接使用而不输入账号密码的。但是,还是加上为好,否则可能出现这样的一种情况:有件没有发送者。这不是很奇怪吗?如何设置账号和密码,其实也就是Jmail中的两个属性而已。自己看Jmail的说明吧,我也记不太清了。