From 2a402ea75a924da4b62f71758044698f98a893f6 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 28 Sep 2017 13:04:38 +0500 Subject: Make user SMTP config more priority --- src/org/traccar/notification/NotificationMail.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/org/traccar') 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); -- cgit v1.2.3