Hooks to be used to receive/send emails.
Author: brian (git@myr.sh)
Date: Sun Jan 28 21:41:15 2024 -0300
Parent: 8cfa547
Improved decode function
diff --git a/receive-example.domain b/receive-example.domain index 4ca8eb3..34fe481 100755 --- a/receive-example.domain +++ b/receive-example.domain @@ -53,7 +53,7 @@ decode() { printf "%s" "$@" | sed -e 's/=?UTF-8?B?//Ig' \ -e 's/?=//g' | base64 -d ;; - *) printf "$s" "$@" ;; + *) printf "%s" "$@" ;; esac } @@ -85,6 +85,7 @@ index() { \__,_/ \____/_____/ \___//_/ </pre> </center> + <br> EOF ls -ogdt --time-style long-iso "$HOME/mail"/* | while read -r g x s d t f @@ -177,7 +178,7 @@ emails() { while read -r k v do - printf "%s %s\n" "$k" "$v" + printf "%s %s\n" "$k" "$v" | escapehtml case "$k" in "Content-Type:") ctype="${v%%;*}" ;; "boundary="*) boundary="$(printf "%s" "${k#*=}" | tr -d ';"')" ;; @@ -280,12 +281,12 @@ save() { "") break ;; esac done - log "mail to $to" # adjust fields to="$(decode "${to##* }" | tr -d '<>"')" eid="$(printf "%s" "${eid:-$(date -Iseconds)}" | tr -d '<>"')" subj="$(decode "$subj" | sed 's@/@/@g')" + log "mail $eid to $to: $subj" # now the rest is a body cat > /dev/null