aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notification-email
diff options
context:
space:
mode:
Diffstat (limited to 'mod/notification-email')
-rw-r--r--mod/notification-email37
1 files changed, 37 insertions, 0 deletions
diff --git a/mod/notification-email b/mod/notification-email
index 8f624e9..5262ee5 100644
--- a/mod/notification-email
+++ b/mod/notification-email
@@ -6,6 +6,7 @@
:global FlushEmailQueue;
:global LogForwardFilterLogForwarding;
:global NotificationFunctions;
+:global QuotedPrintable;
:global SendEMail;
:global SendEMail2;
@@ -144,6 +145,42 @@
}
}
+# convert string to quoted-printable
+:global QuotedPrintable do={
+ :local Input [ :tostr $1 ];
+
+ :if ([ :len $Input ] = 0) do={
+ :return $Input;
+ }
+
+ :local Return "";
+ :local Chars ("\80\81\82\83\84\85\86\87\88\89\8A\8B\8C\8D\8E\8F\90\91\92\93\94\95\96\97" . \
+ "\98\99\9A\9B\9C\9D\9E\9F\A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\B0\B1\B2\B3" . \
+ "\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF\C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF" . \
+ "\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF\E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB" . \
+ "\EC\ED\EE\EF\F0\F1\F2\F3\F4\F5\F6\F7\F8\F9\FA\FB\FC\FD\FE\FF");
+ :local Hex { "0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "A"; "B"; "C"; "D"; "E"; "F" };
+
+ :for I from=0 to=([ :len $Input ] - 1) do={
+ :local Char [ :pick $Input $I ];
+ :local Replace [ :find $Chars $Char ];
+
+ :if ($Char = "=") do={
+ :set Char "=3D";
+ }
+ :if ([ :typeof $Replace ] = "num") do={
+ :set Char ("=" . ($Hex->($Replace / 16 + 8)) . ($Hex->($Replace % 16)));
+ }
+ :set Return ($Return . $Char);
+ }
+
+ :if ($Input = $Return) do={
+ :return $Input;
+ }
+
+ :return ("=\?utf-8\?Q\?" . $Return . "\?=");
+}
+
# send notification via e-mail - expects at least two string arguments
:set SendEMail do={
:global SendEMail2;