aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-10-07 14:17:43 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-10-07 14:21:39 +0200
commit38a3ef955293d51971f11149f37de75ebb1a630d (patch)
tree5d5c6af9861fba134461a2ab04f05292040af1b8
parenta0d170924450341fd1229a40e7095763c1440dfe (diff)
global-functions: $MailServerIsUp: return gracefully on missing configuration
-rw-r--r--global-functions11
1 files changed, 11 insertions, 0 deletions
diff --git a/global-functions b/global-functions
index ad5651e..ba957a1 100644
--- a/global-functions
+++ b/global-functions
@@ -417,8 +417,19 @@
:set MailServerIsUp do={
:local MailServer [ / tool e-mail get address ];
+ :global EmailGeneralTo;
+
:global LogPrintExit;
+ :if ([ :len $EmailGeneralTo ] = 0) do={
+ :return true;
+ } else={
+ :if ($MailServer = "0.0.0.0") do={
+ $LogPrintExit warning ("No mail server is configured! Returning gracefully...") false;
+ :return true;
+ }
+ }
+
:if ([ :len [ / tool netwatch find where comment=$MailServer ] ] = 0) do={
$LogPrintExit warning ("Adding netwatch entry for mail server.") false;
:local MailHost $MailServer;