diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-03 22:18:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-03 22:18:38 +0800 |
commit | 00f496895e056ecec5c804565df07d62fafc62a2 (patch) | |
tree | 6a90d396d18be928f242221f050c5ff4915642f0 /src | |
parent | e177e7d083a4dd3f64172802661bf658d26d1163 (diff) | |
parent | 2498caf8e965c25e4c177a8a075f37b8937c8be3 (diff) | |
download | traccar-server-00f496895e056ecec5c804565df07d62fafc62a2.tar.gz traccar-server-00f496895e056ecec5c804565df07d62fafc62a2.tar.bz2 traccar-server-00f496895e056ecec5c804565df07d62fafc62a2.zip |
Merge pull request #2185 from Abyss777/java_mail_optimization
Mail optimization fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/notification/NotificationMail.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index 944200f2f..a0b80d2ab 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -48,14 +48,11 @@ public final class NotificationMail { result.put("mail.smtp.port", config.getString("mail.smtp.port", "25")); if (config.getBoolean("mail.smtp.starttls.enable")) { - result.put("mail.smtp.starttls.enable", - config.getBoolean("mail.smtp.starttls.enable")); + result.put("mail.smtp.starttls.enable", config.getBoolean("mail.smtp.starttls.enable")); } else if (config.getBoolean("mail.smtp.ssl.enable")) { - result.put("mail.smtp.socketFactory.port", - result.getProperty("mail.smtp.port")); - result.put("mail.smtp.socketFactory.class", - "javax.net.ssl.SSLSocketFactory"); + result.put("mail.smtp.ssl.enable", config.getBoolean("mail.smtp.ssl.enable")); } + result.put("mail.smtp.ssl.trust", config.getBoolean("mail.smtp.ssl.trust")); result.put("mail.smtp.auth", config.getBoolean("mail.smtp.auth")); result.put("mail.smtp.user", config.getString("mail.smtp.username", null)); @@ -77,12 +74,10 @@ public final class NotificationMail { result.put("mail.smtp.starttls.enable", tls); } else if (object.getAttributes().containsKey("mail.smtp.ssl.enable")) { boolean ssl = Boolean.parseBoolean((String) object.getAttributes().get("mail.smtp.ssl.enable")); - if (ssl) { - result.put("mail.smtp.socketFactory.port", - result.getProperty("mail.smtp.port")); - result.put("mail.smtp.socketFactory.class", - "javax.net.ssl.SSLSocketFactory"); - } + result.put("mail.smtp.ssl.enable", ssl); + } + if (object.getAttributes().containsKey("mail.smtp.ssl.trust")) { + result.put("mail.smtp.ssl.trust", object.getAttributes().get("mail.smtp.ssl.trust")); } boolean auth = Boolean.parseBoolean((String) object.getAttributes().get("mail.smtp.auth")); result.put("mail.smtp.auth", auth); @@ -117,7 +112,7 @@ public final class NotificationMail { return; } } - mailSession = Session.getDefaultInstance(mailServerProperties, null); + mailSession = Session.getInstance(mailServerProperties, null); mailMessage = new MimeMessage(mailSession); |