aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-01-11 09:42:25 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-01-11 12:28:31 +0100
commitc8e22f33c25db61a3f8287aae812017f79e8cba1 (patch)
tree4bb172b0c4c5c9faf0f86fa146065979f71edc75
parenta953a8fa59b110ce6016f5773a7b9b601651a291 (diff)
mod/notification-email: split off generation of subject
-rw-r--r--mod/notification-email27
1 files changed, 17 insertions, 10 deletions
diff --git a/mod/notification-email b/mod/notification-email
index 5262ee5..8868941 100644
--- a/mod/notification-email
+++ b/mod/notification-email
@@ -5,6 +5,7 @@
:global FlushEmailQueue;
:global LogForwardFilterLogForwarding;
+:global NotificationEMailSubject;
:global NotificationFunctions;
:global QuotedPrintable;
:global SendEMail;
@@ -92,24 +93,30 @@
# generate filter for log-forward
:set LogForwardFilterLogForwarding do={
- :global Identity;
-
:global EscapeForRegEx;
- :global QuotedPrintable;
+ :global NotificationEMailSubject;
:global SymbolForNotification;
:return ("^Error sending e-mail <(" . \
- [ $EscapeForRegEx [ $QuotedPrintable ("[" . $Identity . "] " . \
- [ $SymbolForNotification "memo" ] . "Log Forwarding") ] ] . "|" . \
- [ $EscapeForRegEx [ $QuotedPrintable ("[" . $Identity . "] " . \
- [ $SymbolForNotification "warning-sign" ] . "Log Forwarding") ] ] . ")>:");
+ [ $EscapeForRegEx [ $NotificationEMailSubject ([ $SymbolForNotification \
+ "memo" ] . "Log Forwarding") ] ] . "|" . \
+ [ $EscapeForRegEx [ $NotificationEMailSubject ([ $SymbolForNotification \
+ "warning-sign" ] . "Log Forwarding") ] ] . ")>:");
+}
+
+# generate the e-mail subject
+:set NotificationEMailSubject do={
+ :global Identity;
+
+ :global QuotedPrintable;
+
+ :return [ $QuotedPrintable ("[" . $Identity . "] " . $1) ];
}
# send notification via e-mail - expects one array argument
:set ($NotificationFunctions->"email") do={
:local Notification $1;
- :global Identity;
:global EmailGeneralTo;
:global EmailGeneralToOverride;
:global EmailGeneralCc;
@@ -118,7 +125,7 @@
:global EitherOr;
:global IfThenElse;
- :global QuotedPrintable;
+ :global NotificationEMailSubject;
:local To [ $EitherOr ($EmailGeneralToOverride->($Notification->"origin")) $EmailGeneralTo ];
:local Cc [ $EitherOr ($EmailGeneralCcOverride->($Notification->"origin")) $EmailGeneralCc ];
@@ -134,7 +141,7 @@
:local Signature [ /system/note/get note ];
:set ($EmailQueue->[ :len $EmailQueue ]) {
to=$To; cc=$Cc;
- subject=[ $QuotedPrintable ("[" . $Identity . "] " . ($Notification->"subject")) ];
+ subject=[ $NotificationEMailSubject ($Notification->"subject") ];
body=(($Notification->"message") . \
[ $IfThenElse ([ :len ($Notification->"link") ] > 0) ("\n\n" . ($Notification->"link")) "" ] . \
[ $IfThenElse ([ :len $Signature ] > 0) ("\n-- \n" . $Signature) "" ]); \