Created
September 27, 2017 20:22
-
-
Save dado3212/e495e0bf78f318d7f796ba3d65105073 to your computer and use it in GitHub Desktop.
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 | |
recepients=( | |
"recipient@website.com" | |
) | |
sender="sender@website.com" | |
senderName="Sender Name" | |
# error handling | |
function err_exit { echo -e 1>&2; exit 1; } | |
# create message | |
function mail_input { | |
echo "ehlo $(hostname -f)" | |
echo "MAIL FROM: <$sender>" | |
echo "RCPT TO: <$1>" | |
echo "DATA" | |
echo "From: $senderName <$sender>" | |
echo "Reply-To: $senderName <$sender>" | |
echo "Subject: This is a subject" | |
echo "What a great email." | |
echo "." | |
echo "quit" | |
} | |
# mail_input | |
for i in "${recepients[@]}" | |
do | |
mail_input $i | nc localhost 25 || err_exit | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment