diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-28 23:01:23 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-28 23:01:23 +1300 |
commit | 92473a5eed53bc6c525665b4947fd31776a1bc8f (patch) | |
tree | 4901eb52abf7656c2b2eda832b25ffcc7871d5a4 /src/org | |
parent | df3f07f78e0804ed06dad8cb1f27f2c81bb7e899 (diff) | |
parent | 2a402ea75a924da4b62f71758044698f98a893f6 (diff) | |
download | trackermap-server-92473a5eed53bc6c525665b4947fd31776a1bc8f.tar.gz trackermap-server-92473a5eed53bc6c525665b4947fd31776a1bc8f.tar.bz2 trackermap-server-92473a5eed53bc6c525665b4947fd31776a1bc8f.zip |
Merge pull request #3553 from Abyss777/fix_3552
Make user SMTP config more priority than server
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/notification/NotificationMail.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index fc70a6115..8707b10da 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -87,13 +87,16 @@ public final class NotificationMail { public static void sendMailSync(long userId, Event event, Position position) throws MessagingException { User user = Context.getPermissionsManager().getUser(userId); - Properties properties = getProperties(new PropertiesProvider(Context.getConfig())); - if (!properties.containsKey("mail.smtp.host")) { + Properties properties = null; + if (!Context.getConfig().getBoolean("mail.smtp.ignoreUserConfig")) { properties = getProperties(new PropertiesProvider(user)); - if (!properties.containsKey("mail.smtp.host")) { - Log.warning("No SMTP configuration found"); - return; - } + } + if (properties == null || !properties.containsKey("mail.smtp.host")) { + properties = getProperties(new PropertiesProvider(Context.getConfig())); + } + if (!properties.containsKey("mail.smtp.host")) { + Log.warning("No SMTP configuration found"); + return; } Session session = Session.getInstance(properties); |