aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/postfix/files
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-09-02 01:08:25 +0100
committerGravatar Joe Banks <[email protected]>2024-09-03 10:43:37 +0100
commit56e9a9269c5a56aab21138f7258e3fed227e6001 (patch)
tree2ea116f595de555fe98e9be2f1bbe002c25cbe1c /ansible/roles/postfix/files
parentTreat NGINX responses as UTF-8 (diff)
Migrate service scripts from files to templates
Diffstat (limited to 'ansible/roles/postfix/files')
-rwxr-xr-xansible/roles/postfix/files/services/fortune-reply.sh39
1 files changed, 0 insertions, 39 deletions
diff --git a/ansible/roles/postfix/files/services/fortune-reply.sh b/ansible/roles/postfix/files/services/fortune-reply.sh
deleted file mode 100755
index 97f2ce8..0000000
--- a/ansible/roles/postfix/files/services/fortune-reply.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-# Read the entire email into a variable
-EMAIL=$(cat)
-
-# Extract the sender's email address
-SENDER=$(echo "$EMAIL" | maddr -a -h from -)
-
-# Extract the Message-ID of the original email
-MESSAGE_ID=$(echo "$EMAIL" | mhdr -h message-id -)
-
-# Extract the original Subject and prefix it with "Re: " if necessary
-ORIGINAL_SUBJECT=$(echo "$EMAIL" | mhdr -h subject -)
-
-# Construct the reply subject
-REPLY_SUBJECT="Re: $ORIGINAL_SUBJECT"
-
-# Extract the To address
-TO_ADDRESS=$(echo "$EMAIL" | maddr -a -h to -)
-
-# Generate the fortune output
-if [[ "$TO_ADDRESS" =~ "fortune+cowsay" ]]; then
- FORTUNE_OUTPUT=$(/usr/games/fortune | /usr/games/cowsay)
-else
- FORTUNE_OUTPUT=$(/usr/games/fortune)
-fi
-
-# Send a reply with the proper headers
-(
- echo "Subject: $REPLY_SUBJECT"
- echo "From: Fortunes by Python Discord <[email protected]>"
- echo "To: $SENDER"
- echo "In-Reply-To: $MESSAGE_ID"
- echo "References: $MESSAGE_ID"
- echo
- echo "Here's your fortune:"
- echo
- echo "$FORTUNE_OUTPUT"
-) | /usr/sbin/sendmail -t