How to send a test e-mail from shell

If you want to manually check if e-mail delivery works on a machine by sending an e-mail you can run the following:
mail -s Test someone@example.com < /dev/null

This will send an empty e-mail with "Test" as its subject to someone@example.com.

If you want it to contain a message body, call mail -s Test someone@example.com only; the mail application will then read your input from stdin. Finish your message by sending EOT Show archive.org snapshot with Ctrl-D -- if you are asked for anything else (like CC addresses) you may press Ctrl-D again.

Arne Hartherz About 13 years ago