From 2e22e2755e1943dcfe3701c7222757c6daa60f82 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Mon, 2 Sep 2024 20:13:52 +0200 Subject: Include sender date as a unix timestamp --- ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 b/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 index d728d14..0bfbf01 100644 --- a/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 +++ b/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 @@ -12,6 +12,9 @@ SENDER=$(echo "$EMAIL" | maddr -h from -) # Grab the display name of the sender SENDER_DISPLAY_NAME=$(echo "$EMAIL" | maddr -h from -d -) +# Sender date as a unix timestamp +DATE_UNIX=$(echo "$EMAIL" | mhdr -h date -D -) + # Find message ID to use later to add to a reply chain MESSAGE_ID=$(echo "$EMAIL" | mhdr -h message-id -) @@ -35,8 +38,9 @@ JSON_BODY=$(echo -n "$BODY" | jq -R -s . | sed 's/\\n/\\\\n/g') FINAL_JSON=$(jq -r -c -n \ --arg from "$SENDER" \ --arg subject "$ORIGINAL_SUBJECT" \ + --arg sent_at "$DATE_UNIX" \ --argjson body "$JSON_BODY" \ - '{from: $from, subject: $subject, body: $body}') + '{sent_at: $sent_at, from: $from, subject: $subject, body: $body}') FRED_RESPONSE=$(curl -X POST "$FREDRICK_ENDPOINT" \ -H "Authorization: $FREDRICK_TOKEN" \ -- cgit v1.2.3