From b517b26517d13299fe020670288e441e4000cf8f Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 17 Nov 2022 22:18:16 +0100 Subject: mod/notification-email: check that attachment exists --- mod/notification-email | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mod/notification-email b/mod/notification-email index 023c4db..81ca563 100644 --- a/mod/notification-email +++ b/mod/notification-email @@ -43,8 +43,15 @@ :foreach Id,Message in=$EmailQueue do={ :if ([ :typeof $Message ] = "array" ) do={ - :local Attach [ :toarray [ $EitherOr ($Message->"attach") "" ] ]; + :local Attach ({}); :while ([ /tool/e-mail/get last-status ] = "in-progress") do={ :delay 1s; } + :foreach File in=[ :toarray [ $EitherOr ($Message->"attach") "" ] ] do={ + :if ([ :len [ /file/find where name=$File ] ] = 1) do={ + :set Attach ($Attach, $File); + } else={ + $LogPrintExit2 warning $0 ("File '" . $File . "' does not exist, can not attach.") false; + } + } /tool/e-mail/send to=($Message->"to") cc=($Message->"cc") subject=($Message->"subject") \ body=($Message->"body") file=$Attach; :local Wait true; -- cgit v1.2.3-54-g00ecf