aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-11 23:10:10 +1200
committerGitHub <noreply@github.com>2016-07-11 23:10:10 +1200
commit817360eee7dba57cf8b58e858f7acf60f27b5e68 (patch)
tree570ad7697e70a1b1d2ca6c2f5c38d204235e46cf /src
parent063ca2ff893a3db3977a42ea960787b067c549db (diff)
parentfe9ab15104d36a5d8d01375f9540d59a835bce5e (diff)
downloadtrackermap-server-817360eee7dba57cf8b58e858f7acf60f27b5e68.tar.gz
trackermap-server-817360eee7dba57cf8b58e858f7acf60f27b5e68.tar.bz2
trackermap-server-817360eee7dba57cf8b58e858f7acf60f27b5e68.zip
Merge pull request #2097 from Abyss777/master
Fix from in mail notifications
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/notification/NotificationMail.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java
index 443018221..944200f2f 100644
--- a/src/org/traccar/notification/NotificationMail.java
+++ b/src/org/traccar/notification/NotificationMail.java
@@ -87,9 +87,15 @@ public final class NotificationMail {
boolean auth = Boolean.parseBoolean((String) object.getAttributes().get("mail.smtp.auth"));
result.put("mail.smtp.auth", auth);
- result.put("mail.smtp.username", object.getAttributes().get("mail.smtp.username"));
- result.put("mail.smtp.password", object.getAttributes().get("mail.smtp.password"));
- result.put("mail.smtp.from", object.getAttributes().get("mail.smtp.from"));
+ if (object.getAttributes().containsKey("mail.smtp.username")) {
+ result.put("mail.smtp.username", object.getAttributes().get("mail.smtp.username"));
+ }
+ if (object.getAttributes().containsKey("mail.smtp.password")) {
+ result.put("mail.smtp.password", object.getAttributes().get("mail.smtp.password"));
+ }
+ if (object.getAttributes().containsKey("mail.smtp.from")) {
+ result.put("mail.smtp.from", object.getAttributes().get("mail.smtp.from"));
+ }
}
return result;
}
@@ -115,6 +121,10 @@ public final class NotificationMail {
mailMessage = new MimeMessage(mailSession);
+ if (mailServerProperties.getProperty("mail.smtp.from") != null) {
+ mailMessage.setFrom(new InternetAddress(mailServerProperties.getProperty("mail.smtp.from")));
+ }
+
mailMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(
Context.getDataManager().getUser(userId).getEmail()));
mailMessage.setSubject(NotificationFormatter.formatTitle(userId, event, position));