diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-04 14:29:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-04 14:29:12 +0800 |
commit | 41668cae9763a523c775a8a998620fe286176c9e (patch) | |
tree | 726c0c6effdeced9903b6b26ef0480047d2d179c /src | |
parent | b6f82f2b3894df234d528a5feb303f81d3620259 (diff) | |
parent | 870da4a100bedf1c21e43d6ab708de5c6a023c94 (diff) | |
download | trackermap-server-41668cae9763a523c775a8a998620fe286176c9e.tar.gz trackermap-server-41668cae9763a523c775a8a998620fe286176c9e.tar.bz2 trackermap-server-41668cae9763a523c775a8a998620fe286176c9e.zip |
Merge pull request #2187 from Abyss777/java_mail_optimization
Handle no SMTP parameters correctly
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/notification/NotificationMail.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index a0b80d2ab..f9d42968f 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -55,9 +55,19 @@ public final class NotificationMail { 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)); - result.put("mail.smtp.password", config.getString("mail.smtp.password", null)); - result.put("mail.smtp.from", config.getString("mail.smtp.from", null)); + + String username = config.getString("mail.smtp.username"); + if (username != null) { + result.put("mail.smtp.user", username); + } + String password = config.getString("mail.smtp.password"); + if (password != null) { + result.put("mail.smtp.password", password); + } + String from = config.getString("mail.smtp.from"); + if (from != null) { + result.put("mail.smtp.from", from); + } } return result; } |