雅虎SMTP连接超时

雅虎SMTP连接超时,smtp,jakarta-mail,yahoo-mail,Smtp,Jakarta Mail,Yahoo Mail,我的应用程序中有一段代码,它使用Yahoo作为邮件中继发送电子邮件。 这段代码已经运行了好几个月了,但在过去的几个月里,我在尝试发送电子邮件时收到了“连接超时”。 这段代码是用Java编写的,并使用SMTP 这段代码适用于GMail。使用GMail作为邮件提供商的问题在于 谷歌在这项服务中遇到的一系列麻烦(不太安全的应用程序激活、浏览器登录、验证码取消…) 有什么想法吗?提前谢谢 Properties props = System.getProperties(); props.put("

我的应用程序中有一段代码,它使用Yahoo作为邮件中继发送电子邮件。 这段代码已经运行了好几个月了,但在过去的几个月里,我在尝试发送电子邮件时收到了“连接超时”。 这段代码是用Java编写的,并使用SMTP

这段代码适用于GMail。使用GMail作为邮件提供商的问题在于 谷歌在这项服务中遇到的一系列麻烦(不太安全的应用程序激活、浏览器登录、验证码取消…)

有什么想法吗?提前谢谢

Properties props = System.getProperties();
props.put("mail.smtp.host", SMTP);
props.put("mail.smtp.port", "587");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.auth", "true");

Session session = Session.getInstance(props, new Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(USER, PASS);
    }
});

session.setDebug(true);
MimeMessage mm = new MimeMessage(session);
mm.setSubject(subject);
mm.setFrom(USER);

for (String recipient : recipients) {
    mm.addRecipients(Message.RecipientType.BCC,InternetAddress.parse(recipient, false));
}

mm.setSentDate(new Date());
mm.setContent(message, "text/HTML; charset=UTF-8");         

Transport.send(mm);