mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-14 20:14:29 +02:00
mod/notification-email: check that attachment exists
This commit is contained in:
parent
71d1f2a781
commit
b517b26517
1 changed files with 8 additions and 1 deletions
|
@ -43,8 +43,15 @@
|
||||||
|
|
||||||
:foreach Id,Message in=$EmailQueue do={
|
:foreach Id,Message in=$EmailQueue do={
|
||||||
:if ([ :typeof $Message ] = "array" ) 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; }
|
: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") \
|
/tool/e-mail/send to=($Message->"to") cc=($Message->"cc") subject=($Message->"subject") \
|
||||||
body=($Message->"body") file=$Attach;
|
body=($Message->"body") file=$Attach;
|
||||||
:local Wait true;
|
:local Wait true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue