javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at com.smax.mail.struts2.action.SimpleMailSender.sendTextMail(SimpleMailSender.java:64)
at com.smax.mail.struts2.action.NewmailAction.add(NewmailAction.java:183)
at com.smax.sys.struts2.SupperAction.execute(SupperAction.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
在发送时报了这个错 大家谁知道告诉下
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at com.smax.mail.struts2.action.SimpleMailSender.sendTextMail(SimpleMailSender.java:64)
at com.smax.mail.struts2.action.NewmailAction.add(NewmailAction.java:183)
at com.smax.sys.struts2.SupperAction.execute(SupperAction.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
在发送时报了这个错 大家谁知道告诉下
props.put("mail.smtp.host","smtp.163.com");
props.put("mail.smtp.auth","true");
props.put("mail.smtp.user", "[email protected]");
props.put("mail.smtp.password", "0");
//下面的Sessioni要验证
Session session = Session.getInstance(props, new PopupAuthenticator("[email protected]", "0")
PopupAuthenticator类:
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
public class PopupAuthenticator extends Authenticator
{
String username=null;
String password=null;
public PopupAuthenticator(String user, String pass)
{
username = user;
password = pass;
}
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username, password);
}
}