Created
May 3, 2024 17:56
-
-
Save clicktechnology/5dfdd0071975203d4960b304af72fb03 to your computer and use it in GitHub Desktop.
process-mail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $2 is the email sender. We want to autoreply to them | |
# $4 is our filter user email address, typically filter@localhost | |
# Check the parameters below are right for your system | |
SENDMAIL="/usr/lib/sendmail" | |
DOMAIN="YOUR-DOMAIN-NAME-HERE.com" | |
LOCAL_AUTOREPLY_ADDRESS="filter@localhost" | |
if [ "$4" = $LOCAL_AUTOREPLY_ADDRESS ]; then | |
echo "OK, I'll send a reply to |$2|" | |
printf '%s\n' "Subject: Autoreply from $DOMAIN" \ | |
"From: Autoreply <autoreply@$DOMAIN>" \ | |
"To: Recipient <$2>" \ | |
"" \ | |
"--------------------------------------------------------------------------------" \ | |
" " \ | |
" This is the autoresponder for $DOMAIN. Your mail was received!" \ | |
" " \ | |
"--------------------------------------------------------------------------------" | $SENDMAIL -oi -t | |
else | |
echo "Not an autoreply address." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment