This is a simple way to get an email from a *nix command line that will test that emails can be sent. I’ve also set it up so that it tells you the name of the user who sent the email and the machine from which it was sent. The time and date is so that if you’re testing multiple times, you can see which emails made it and compare with several users.
echo "Test from `whoami`@`uname -n` on `date`" | mail -s "Test email from `uname -n`" <address1> <address2> <address3...>
This should create an email with the *nix user as the sender to the addresses specified with the subject and the time and date set at the time of sending.
It should help to diagnose if mail is working.
Leave a Reply