final String to = maildata.mailadres;
// Mailadres van
final String from = "right@email.com";
// host voor e-mail
String host = "###.##.#.#";
Properties props = new java.util.Properties();
props.put("mail.smtp.host", "###.##.#.#");
props.put("mail.smtp.port", "##");
props.put("mail.smtp.starttls.enable", "false");
props.put("mail.smtp.auth", "true");
// Setup mail server
props.setProperty("mail.smtp.host", host);
Session session = javax.mail.Session.getInstance( props,
new javax.mail.Authenticator() {
protected javax.mail.PasswordAuthentication getPasswordAuthentication() {
return new javax.mail.PasswordAuthentication("####", "#####");
}
});
由于某种原因,对活动目录的身份验证失败(显然主机等是正确的) 它确实正确地发送邮件,但只是忽略了身份验证