diff options
author | Abyss777 <abyss@fox5.ru> | 2017-09-28 13:04:38 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-09-28 14:39:36 +0500 |
commit | 2a402ea75a924da4b62f71758044698f98a893f6 (patch) | |
tree | 4901eb52abf7656c2b2eda832b25ffcc7871d5a4 /src/org/traccar | |
parent | df3f07f78e0804ed06dad8cb1f27f2c81bb7e899 (diff) | |
download | traccar-server-2a402ea75a924da4b62f71758044698f98a893f6.tar.gz traccar-server-2a402ea75a924da4b62f71758044698f98a893f6.tar.bz2 traccar-server-2a402ea75a924da4b62f71758044698f98a893f6.zip |
Make user SMTP config more priority
Diffstat (limited to 'src/org/traccar')
-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); |