mod/notification-email: add error handling when sending mail

This commit is contained in:
Christian Hesse 2025-05-08 11:21:59 +02:00
parent bd3cc3bbd4
commit ff218e4ce5

View file

@ -89,8 +89,9 @@
:foreach Id,Message in=$EmailQueue do={
:if ([ :typeof $Message ] = "array" ) do={
:local Attach ({});
:while ([ /tool/e-mail/get last-status ] = "in-progress") do={ :delay 1s; }
:onerror Err {
:local Attach ({});
:foreach File in=[ :toarray [ $EitherOr ($Message->"attach") "" ] ] do={
:if ([ :len [ /file/find where name=$File ] ] = 1) do={
:set Attach ($Attach, $File);
@ -118,6 +119,10 @@
:set Wait false;
}
} while=($Wait = true);
} do={
$LogPrint warning $0 ("Sending queued mail failed: " . $Err);
:set AllDone false;
}
}
}