aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/notification/NotificationMail.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-28 23:01:23 +1300
committerGitHub <noreply@github.com>2017-09-28 23:01:23 +1300
commit92473a5eed53bc6c525665b4947fd31776a1bc8f (patch)
tree4901eb52abf7656c2b2eda832b25ffcc7871d5a4 /src/org/traccar/notification/NotificationMail.java
parentdf3f07f78e0804ed06dad8cb1f27f2c81bb7e899 (diff)
parent2a402ea75a924da4b62f71758044698f98a893f6 (diff)
downloadtrackermap-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/traccar/notification/NotificationMail.java')
-rw-r--r--src/org/traccar/notification/NotificationMail.java15
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);