我使用此代码发送电子邮件
Email email = new SimpleEmail();
email.setDebug(true);
email.setHostName("webmail.company.com");
email.setSmtpPort(587);
email.setAuthenticator(new DefaultAuthenticator("username@company.com", "*****"));
email.setSSLOnConnect(true);
try {
email.setFrom("username@company.com");
email.setSubject("TestMail");
email.setMsg("Hi "+receiver.getSex()+" "+receiver.getName()+" "+editorBean.getValue());
email.addTo(receiver.getEmail());
email.send();
} catch (EmailException ex) {
Logger.getLogger(PersonBean.class.getName()).log(Level.SEVERE, null, ex);
result += "exptions :" + ex.getMessage();
return result;
}
而且我认为 smtp 端口没有改变“将电子邮件发送到以下服务器失败:webmail.company.com:465”有什么问题?