From bc1200c630acd977eabf358c33dd3d95dc0f8385 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Mon, 2 Sep 2024 20:08:32 +0200 Subject: Add top posting to vacation script --- ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ansible') diff --git a/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 b/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 index c0f26d6..d728d14 100644 --- a/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 +++ b/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 @@ -9,9 +9,14 @@ EMAIL=$(cat) # Find the sender SENDER=$(echo "$EMAIL" | maddr -h from -) +# Grab the display name of the sender +SENDER_DISPLAY_NAME=$(echo "$EMAIL" | maddr -h from -d -) + # Find message ID to use later to add to a reply chain MESSAGE_ID=$(echo "$EMAIL" | mhdr -h message-id -) +MESSAGE_DATE=$(echo "$EMAIL" | mhdr -h date -) + # Extract the original Subject and prefix it with "Re: " if necessary ORIGINAL_SUBJECT=$(echo "$EMAIL" | mhdr -h subject -) @@ -50,4 +55,8 @@ FILTERED=$(echo "$FRED_RESPONSE" | grep -v "^Subject:") echo "References: $MESSAGE_ID" echo echo "$FILTERED" + echo + # Quote the original message + echo "On $MESSAGE_DATE, $SENDER_DISPLAY_NAME wrote:" + echo "$BODY" | awk -F '\n' '{ print "> " $1 }' ) | /usr/sbin/sendmail -t -- cgit v1.2.3