How to send a test e-mail from shell

Posted About 13 years ago. Visible to the public.

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
Last edit
Over 11 years ago
Keywords
bash, linux, unix
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2011-04-04 11:58)