|
@@ -344,9 +344,12 @@ public class EmailUtil {
|
|
|
Properties properties = new Properties();
|
|
|
properties.put("mail.smtp.host", mailboxInfoDTO.getHost());
|
|
|
properties.put("mail.smtp.auth", true);
|
|
|
- properties.setProperty("mail.smtp.port", mailboxInfoDTO.getPort());
|
|
|
- properties.put("mail.smtp.ssl.required", false);
|
|
|
+ properties.put("mail.smtp.port", mailboxInfoDTO.getPort());
|
|
|
properties.put("mail.smtp.ssl.enable", true);
|
|
|
+ final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
|
|
|
+ properties.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
|
|
|
+ properties.setProperty("mail.smtp.socketFactory.fallback", "false");
|
|
|
+ properties.setProperty("mail.smtp.socketFactory.port", mailboxInfoDTO.getPort());
|
|
|
// 根据邮件的会话属性构造一个发送邮件的Session,
|
|
|
JakartaUserPassAuthenticator authenticator = new JakartaUserPassAuthenticator(mailboxInfoDTO.getAccount(), mailboxInfoDTO.getPassword());
|
|
|
Session session = Session.getInstance(properties, authenticator);
|