aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-06-16 14:56:55 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-06-17 15:06:35 +0200
commit34c9da5aa2c7cb1d8cae3c0441cb29c20022a8b2 (patch)
treebe580abf807c75612ed58128fd65be743470beb6
parent1e1b98b161d0d8a2e9930c4676a44e898dd9049d (diff)
global-functions: $NotificationFunctions->"email": support removing attachment
-rw-r--r--global-functions10
1 files changed, 8 insertions, 2 deletions
diff --git a/global-functions b/global-functions
index 2cfe595..422eac0 100644
--- a/global-functions
+++ b/global-functions
@@ -345,8 +345,9 @@
:foreach Id,Message in=$EmailQueue do={
:if ([ :typeof $Message ] = "array" ) do={
+ :local Attach [ $EitherOr ($Message->"attach") "" ];
/ tool e-mail send to=($Message->"to") cc=($Message->"cc") subject=($Message->"subject") \
- body=($Message->"body") file=[ $EitherOr ($Message->"attach") "" ];
+ body=($Message->"body") file=$Attach;
:local Wait true;
:do {
:delay 1s;
@@ -354,6 +355,11 @@
:if ($Status = "succeeded") do={
:set ($EmailQueue->$Id);
:set Wait false;
+ :if (($Message->"remove-attach") = true) do={
+ :foreach File in=[ :toarray $Attach ] do={
+ / file remove $File;
+ }
+ }
}
:if ($Status = "failed") do={
:set AllDone false;
@@ -591,7 +597,7 @@
body=(($Notification->"message") . \
[ $IfThenElse ([ :len ($Notification->"link") ] > 0) ("\n\n" . ($Notification->"link")) "" ] . \
[ $IfThenElse ([ :len $Signature ] > 0) ("\n-- \n" . $Signature) "" ]); \
- attach=($Notification->"attach") };
+ attach=($Notification->"attach"); remove-attach=($Notification->"remove-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;";