Properties p = System.getProperties();
p.put("mail.smtp.host", this.smtp);
p.put("mail.smtp.auth", "true"); //设置为须验证的模式
Session session = Session.getDefaultInstance(p, new Email_ca("user", "password"));
MimeMessage msg = new MimeMessage(session);
msg.setSentDate(new Date());
InternetAddress from = new InternetAddress(frommail);
msg.setFrom(from);
InternetAddress[] address =
{
new InternetAddress(tomail)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(this.subject);
msg.setText(this.content);
Transport.send(msg);
return true;以上改设的都设好了! 但是运行时输出以下信息:
Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
请问高手是怎么回事! smtp.163.com 是开着的!
p.put("mail.smtp.host", this.smtp);
p.put("mail.smtp.auth", "true"); //设置为须验证的模式
Session session = Session.getDefaultInstance(p, new Email_ca("user", "password"));
MimeMessage msg = new MimeMessage(session);
msg.setSentDate(new Date());
InternetAddress from = new InternetAddress(frommail);
msg.setFrom(from);
InternetAddress[] address =
{
new InternetAddress(tomail)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(this.subject);
msg.setText(this.content);
Transport.send(msg);
return true;以上改设的都设好了! 但是运行时输出以下信息:
Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
请问高手是怎么回事! smtp.163.com 是开着的!
2.试试telnet smtp.163.com 25
http://www.donews.net/redtroy/archive/2005/07/06/456210.aspx
试试看