A one-liner to send a test email from the terminal, to the root user:

echo test | mail -s "test message" root

This could be used to test for external redirects for system notices.

Using the sendmail command:

Enter the following command, to write out an email manually:

[root@machine ~]# cat /tmp/emailtext.txt

Type in the following email message (making sure to keep 'Subject', but change the subject text how you will):

Subject: Terminal Email Send

Email Content line 1
Email Content line 2

Type CTRL+D to end the text input. Then send the mail text like so:

sendmail EMAILADDR  < /tmp/emailtext.txt

(replacing EMAILADDR with the requisite address)


See also