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