Last active
August 29, 2015 14:15
-
-
Save zushane/e6d3e34192eea85706d1 to your computer and use it in GitHub Desktop.
Simple mail test script.
This file contains hidden or 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 | |
server=`hostname` | |
timestamp=`date +%s` | |
mail_subject="${1-"$timestamp"} ($server)" | |
mail_address=${2-"[email protected]"} | |
mail_message="/tmp/$timestamp.message" | |
mail_program="/bin/mail" | |
echo "Sending test mail to $mail_address, with subject \"$mail_subject\"" | |
echo "" > $mail_message | |
echo "Test from $server. If you see this, then it worked." >> $mail_message | |
echo "Timestamp: $timestamp" | |
echo "" >> $mail_message | |
$mail_program -s "$mail_subject" "$mail_address" < $mail_message | |
rm $mail_message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment