Hooks to be used to receive/send emails.
Author: blmayer (bleemayer@gmail.com)
Date: Sat Jan 20 01:11:39 2024 -0300
Parent: f807551
Added decode function
diff --git a/receive-example.domain b/receive-example.domain
index f749a97..091ab18 100755
--- a/receive-example.domain
+++ b/receive-example.domain
@@ -1,5 +1,57 @@
#!/bin/sh
+decode() {
+ case "$1" in
+ "=?iso-8859-1?Q?"*)
+ printf "%s" "$@" | sed -e 's/=?iso-8859-1?Q?//Ig' \
+ -e 's/?=//g' \
+ -e 's/=E7/ç/g' \
+ -e 's/=ED/í/g' \
+ -e 's/_/ /g' \
+ -e 's/=E3/ã/g'
+ ;;
+ "=?utf-8?q?"* | "=?utf-8?Q?"* | "=?UTF-8?q?"* | "=?utf-8; format?q?"*)
+ printf "%s" "$@" | sed -e 's/.*=?utf-8\(; format\)\??q?//Ig' \
+ -e 's/?=//g' \
+ -e 's/=F0=9F=8F=AD=C2=A0/🏭/g' \
+ -e 's/=C2=A0=F0=9F=91=87/👇/g' \
+ -e 's/=F0=9F=94=A5/🔥/g' \
+ -e 's/=e2=80=93/-/g' \
+ -e 's/=E2=80=99/’/g' \
+ -e 's/=CE=94/Δ/g' \
+ -e 's/=C3=BA/ú/g' \
+ -e 's/=C3=B5/õ/g' \
+ -e 's/=C3=B4/ô/g' \
+ -e 's/=C3=B3/ó/g' \
+ -e 's/=C3=96/Ö/g' \
+ -e 's/=C3=AD/í/g' \
+ -e 's/=C3=A9/é/g' \
+ -e 's/=C3=AA/ê/g' \
+ -e 's/=C3=A7/ç/g' \
+ -e 's/=C3=A3/ã/g' \
+ -e 's/=C3=A2/â/g' \
+ -e 's/=C3=A1/á/g' \
+ -e 's/=C3=A0/à/g' \
+ -e 's/=3F/?/g' \
+ -e 's/=2D/-/g' \
+ -e 's/=2C/,/g' \
+ -e 's/=20/ /g' \
+ -e 's/=20/ /g' \
+ -e 's/=20/ /g' \
+ -e "s/=27/\\'/g"
+ -e 's/=28/(/g' \
+ -e 's/=29/)/g' \
+ -e 's/=21/!/g' \
+ -e 's/_/ /g' \
+ -e 's/=20/ /g'
+ ;;
+ "=?UTF-8?B?"* | "=?utf-8?B?"*)
+ printf "%s" "$@" | sed -e 's/=?UTF-8?B?//Ig' \
+ -e 's/?=//g' | base64 -d
+ ;;
+ esac
+}
+
escapehtml() {
sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g'
}
@@ -132,7 +184,7 @@ emails() {
if echo "$v" | grep -qv "filename="
then
read -r v
- printf -- "$k $v\n"
+ printf "%s\n" "$k $v"
fn="${v#*filename=}"
fi
fn="${v#*filename=}"