Skip to content

Instantly share code, notes, and snippets.

@zushane
Last active August 29, 2015 14:15
Show Gist options
  • Save zushane/e6d3e34192eea85706d1 to your computer and use it in GitHub Desktop.
Save zushane/e6d3e34192eea85706d1 to your computer and use it in GitHub Desktop.
Simple mail test script.
#!/bin/bash
server=`hostname`
timestamp=`date +%s`
mail_subject="${1-"$timestamp"} ($server)"
mail_address=${2-"test@example.com"}
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