diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-02-27 11:45:49 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-02-27 11:45:49 -0800 |
commit | b9117b29226dae6cf945c2dd961c91c29fcb5d8b (patch) | |
tree | 8350ca995efda3d8468b57a3be39595d11ef450d /src | |
parent | cde8be159a846a76908b961dc7a9f5b925b5289d (diff) | |
download | trackermap-server-b9117b29226dae6cf945c2dd961c91c29fcb5d8b.tar.gz trackermap-server-b9117b29226dae6cf945c2dd961c91c29fcb5d8b.tar.bz2 trackermap-server-b9117b29226dae6cf945c2dd961c91c29fcb5d8b.zip |
Email enabled server flag
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/database/MailManager.java | 6 | ||||
-rw-r--r-- | src/main/java/org/traccar/model/Server.java | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/MailManager.java b/src/main/java/org/traccar/database/MailManager.java index 8a2f002cd..d94f55cda 100644 --- a/src/main/java/org/traccar/database/MailManager.java +++ b/src/main/java/org/traccar/database/MailManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org) * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -87,6 +87,10 @@ public final class MailManager { return properties; } + public boolean getEmailEnabled() { + return Context.getConfig().hasKey("mail.smtp.host"); + } + public void sendMessage( long userId, String subject, String body) throws MessagingException { sendMessage(userId, subject, body, null); diff --git a/src/main/java/org/traccar/model/Server.java b/src/main/java/org/traccar/model/Server.java index e84943efc..7bdb53b22 100644 --- a/src/main/java/org/traccar/model/Server.java +++ b/src/main/java/org/traccar/model/Server.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.traccar.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import org.traccar.Context; import org.traccar.database.QueryIgnore; @JsonIgnoreProperties(ignoreUnknown = true) @@ -176,4 +177,9 @@ public class Server extends ExtendedModel { return getClass().getPackage().getImplementationVersion(); } + @QueryIgnore + public Boolean getEmailEnabled() { + return Context.getMailManager().getEmailEnabled(); + } + } |