邮件

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

mailmessage   mail   =   new   mailmessage();  
  mail.from                 =   "yha77@ntachina.com";  
  mail.to                     =   "yha77@ntachina.com";  
  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  
 

· 网友精彩回答:

发表者:fphuang

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

发表者:sunnystar365

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

发表者:xiedan79

很明显嘛,邮件服务器不存在,最好的办法是   邮件服务器的   ip   地址

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved