global-functions: $SendEMail2: support overriding to and cc

This commit is contained in:
Christian Hesse 2021-04-27 21:20:02 +02:00
parent e97b394536
commit 42dcdae11e

View file

@ -894,14 +894,20 @@
:global Identity; :global Identity;
:global EmailGeneralTo; :global EmailGeneralTo;
:global EmailGeneralToOverride;
:global EmailGeneralCc; :global EmailGeneralCc;
:global EmailGeneralCcOverride;
:global EmailQueue; :global EmailQueue;
:global EitherOr;
:global IfThenElse; :global IfThenElse;
:global LogPrintExit2; :global LogPrintExit2;
:global QuotedPrintable; :global QuotedPrintable;
:if ([ :len $EmailGeneralTo ] = 0) do={ :local To [ $EitherOr ($EmailGeneralToOverride->($Notification->"origin")) $EmailGeneralTo ];
:local Cc [ $EitherOr ($EmailGeneralCcOverride->($Notification->"origin")) $EmailGeneralCc ];
:if ([ :len $To ] = 0) do={
:return false; :return false;
} }
@ -910,7 +916,7 @@
} }
:local Signature [ / system note get note ]; :local Signature [ / system note get note ];
:set ($EmailQueue->[ :len $EmailQueue ]) { :set ($EmailQueue->[ :len $EmailQueue ]) {
to=$EmailGeneralTo; cc=$EmailGeneralCc; to=$To; cc=$Cc;
subject=[ $QuotedPrintable ("[" . $Identity . "] " . ($Notification->"subject")) ]; subject=[ $QuotedPrintable ("[" . $Identity . "] " . ($Notification->"subject")) ];
body=(($Notification->"message") . \ body=(($Notification->"message") . \
[ $IfThenElse ([ :len ($Notification->"link") ] > 0) ("\n\n" . ($Notification->"link")) "" ] . \ [ $IfThenElse ([ :len ($Notification->"link") ] > 0) ("\n\n" . ($Notification->"link")) "" ] . \