而發送的電子郵件顯示錯誤:無法連接到SMTP主機:smtp8.net4india.com,端口:25;
javax.mail.MessagingException: Could not connect to SMTP host: smtp8.net4india.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
我的電子郵件地址設置爲:
String mailProcessed = "";
Properties props = new Properties();
props.put("mail.smtp.host", "smtp8.net4india.com");
props.put("mail.smtp.socketFactory.port", "25");
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "25");
props.put("mail.smtp.starttls.enable", "true");
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(frmMail, frmPass);
}
});
tried..but沒有luck..same錯誤.. – next2u
嘗試添加屬性:'mail.smtp.ssl.enable = TRUE; –