diff options
-rw-r--r-- | ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 | 6 |
1 files changed, 5 insertions, 1 deletions
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" \ |