aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-11-17 22:18:16 +0100
committerGravatar Christian Hesse <mail@eworm.de>2022-11-17 22:18:16 +0100
commitb517b26517d13299fe020670288e441e4000cf8f (patch)
tree2140e68e4f71dec87be25138e10a9805a6854ee4
parent71d1f2a781ad74d2a0d442c4f833dc19ff54ff3d (diff)
mod/notification-email: check that attachment exists
-rw-r--r--mod/notification-email9
1 files changed, 8 insertions, 1 deletions
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;