From 38a3ef955293d51971f11149f37de75ebb1a630d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 7 Oct 2020 14:17:43 +0200 Subject: global-functions: $MailServerIsUp: return gracefully on missing configuration --- global-functions | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'global-functions') 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; -- cgit v1.2.3-54-g00ecf