From 529cefffafca2dedd93f48303db73805d965431f Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 29 Apr 2021 16:22:04 +0200 Subject: global-functions: $SendEMail2: support file attachments --- global-functions | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'global-functions') diff --git a/global-functions b/global-functions index 65c9721..a1a070c 100644 --- a/global-functions +++ b/global-functions @@ -332,6 +332,7 @@ :set FlushEmailQueue do={ :global EmailQueue; + :global EitherOr; :global LogPrintExit2; :local AllDone true; @@ -345,8 +346,8 @@ :foreach Id,Message in=$EmailQueue do={ :if ([ :typeof $Message ] = "array" ) do={ - / tool e-mail send to=($Message->"to") cc=($Message->"cc") \ - subject=($Message->"subject") body=($Message->"body"); + / tool e-mail send to=($Message->"to") cc=($Message->"cc") subject=($Message->"subject") \ + body=($Message->"body") file=[ $EitherOr ($Message->"attach") "" ]; :local Wait true; :do { :delay 1s; @@ -924,7 +925,8 @@ subject=[ $QuotedPrintable ("[" . $Identity . "] " . ($Notification->"subject")) ]; body=(($Notification->"message") . \ [ $IfThenElse ([ :len ($Notification->"link") ] > 0) ("\n\n" . ($Notification->"link")) "" ] . \ - [ $IfThenElse ([ :len $Signature ] > 0) ("\n-- \n" . $Signature) "" ]) }; + [ $IfThenElse ([ :len $Signature ] > 0) ("\n-- \n" . $Signature) "" ]); \ + attach=($Notification->"attach") }; :if ([ :len [ / system scheduler find where name="FlushEmailQueue" ] ] = 0) do={ / system scheduler add name=FlushEmailQueue interval=1s start-time=startup \ on-event=":global FlushEmailQueue; \$FlushEmailQueue;"; -- cgit v1.2.3-70-g09d2