jmail.MessageClass msg=new jmail.MessageClass();
msg.Logging=true;
msg.Silent=true;
msg.Charset="gb2312";
msg.Encoding= "Base64";
msg.ISOEncodeHeaders = false;
msg.From="[email protected]";
msg.FromName="[email protected]";
msg.MailServerUserName="wjf_net";
msg.MailServerPassWord="******";
msg.AddRecipient(this.to.Text.ToString().Trim(),null,null);
msg.Subject=this.sub.Text.ToString();
msg.Body=this.article.Text.ToString();
if(msg.Send("smtp.163.com",false))
{
  this.ss.Text="<font color=red>邮件发送成功!</font>";
}
else
{
                               this.ss.Text="邮件发送失败!";
}我是这么写的,不知道是什么回事
哪们兄弟做过了,请指点一下是什么回事,谢谢

解决方案 »

  1.   

    我是在本地测试,装有SMTP了的
    我用另一种方法发可以,但有时不行,所以想换JMAIL试一试。
    就是不成功。
      

  2.   

    我用这个方法可以发成功 MailMessage msg=new MailMessage();
              msg.From="[email protected]";
    msg.To=this.to.Text;
    msg.Subject=this.sub.Text;
    msg.Body=this.article.Text.Replace("\r\n","<br>").Replace(Convert.ToString(Convert.ToChar(32)),"&nbsp;");
    msg.BodyFormat=MailFormat.Html;
    try
    {
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1" );
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "xxxxx"); 
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxxxx");
        msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport","465"); 
    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "1");
    SmtpMail.SmtpServer="smtp.gmail.com";
    SmtpMail.Send(msg);
    this.ss.Text="The Mail has been sent to:<font color=red>"+this.to.Text+"</font> ";

    }
    catch(System.Exception ex)
    {
    this.ss.Text=ex.Message;
    }
      

  3.   

    <%
    Set JMail=Server.CreateObject("JMail.Message")
    JMail.Logging=True
    JMail.Charset="gb2312"
    JMail.ContentType = "text/html"
    JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
    JMail.MailServerUserName = "[email protected]"
    JMail.MailServerPassword = "dnyes031203"
    JMail.From = "[email protected]" '发件人的信箱
    JMail.FromName = "master" '发件人的名字
    JMail.Subject = "欢迎您在信网注册用户" '邮件的主题
    JMail.Body = "test test ,ok" '邮件的内容
    '==============================收件人的地址!
    JMail.AddRecipient("[email protected]") '收件人的地址
    JMail.Priority=5 '邮件级别1-5数字越大级别越高---3为普通邮件
    JMail.Send("218.244.47.25") '红色变量是邮件服务器地址
    JMail.Close
    Set JMail=nothing 
    %>
      

  4.   

    我也是这么写的呀
    不过是在.net下面的
    但不成功。不知道是什么回事
      

  5.   

    你的机器是不是装防火墙了~?有些防火墙会自动屏蔽SendMail这个函数~
      

  6.   

    The message was undeliverable. All servers failed to receive the message出现以上错误
      

  7.   

    smtp server需要allow relay. 很多smtp server都不支持。
    可能是这个原因,大家讨论一下吧。
      

  8.   

    兄弟们,用163是可以有
    之前不行是因为防火墙栏了25端口
    。但我换成了gmail就不行了。