aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2024-09-02 20:08:32 +0200
committerGravatar Joe Banks <[email protected]>2024-09-03 10:43:39 +0100
commitbc1200c630acd977eabf358c33dd3d95dc0f8385 (patch)
tree6a4aa2aeb296f186b56cb52c35822d590fa181a4
parentAdd tag for rolling out service scripts (diff)
Add top posting to vacation script
-rw-r--r--ansible/roles/postfix/templates/services/fredrick-reply.sh.j29
1 files changed, 9 insertions, 0 deletions
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