2. Using the JavaMail packages, I have no problem sending e-mail to mail.hotmail.com, doing the following: Properties props = new Properties(); props.put("mail.SMTP.host", "mail.hotmail.com"); Session session = Session.getDefaultInstance(props, null); try { Message msg = new MimeMessage(session); InternetAddress from = new InternetAddress("abc.xxx.com"); msg.setFrom (from); InternetAddress recipient = new InternetAddress("[email protected]"); msg.setRecipient(Message.RecipientType.TO, recipient); msg.setSubject("test subject"); msg.setContent ("test body", "text/plain"); Transport.send(msg); } catch (Exception e) ... 假如上面的不行,请你试试:jhttpmail这个组件,是不要钱的。呵呵,客户没有smtp服务器,你怎么发信?没有了mta,能发信吗?需要验证的服务器一般来说,第一个客户应答是EHLO,而不是HELO,但是在程序中不好判断mail服务器是否存在smtp验证的问题。
java mail 现在只能支持SMTP、IMAP4 和 POP3其他的还不能支持,你可以写两个连接程序一个要验证一个不用,try第一个不行的话再try第二个。呵呵
像国外的hotmail就没有服务器,那么我的程序应该怎么设置?frommail="寄信地址"
mailsubject="主题"
mailbody="正文"tomail="收信地址"
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = frommail
objCDOMail.To = tomail
objCDOMail.Subject = mailsubject
objCDOMail.Body = mailbody
Set objCDOMail = Nothing
Properties props = new Properties();
props.put("mail.SMTP.host", "mail.hotmail.com");
Session session = Session.getDefaultInstance(props, null);
try
{
Message msg = new MimeMessage(session);
InternetAddress from = new InternetAddress("abc.xxx.com");
msg.setFrom (from);
InternetAddress recipient = new InternetAddress("[email protected]");
msg.setRecipient(Message.RecipientType.TO, recipient);
msg.setSubject("test subject");
msg.setContent ("test body", "text/plain");
Transport.send(msg);
}
catch (Exception e) ...
假如上面的不行,请你试试:jhttpmail这个组件,是不要钱的。呵呵,客户没有smtp服务器,你怎么发信?没有了mta,能发信吗?需要验证的服务器一般来说,第一个客户应答是EHLO,而不是HELO,但是在程序中不好判断mail服务器是否存在smtp验证的问题。
那里可能有你需要的:)