Brainstorm's snippets (1/228)

  Send email from command line

Using mail

mail someone@gmail.com
    Subject: Hello World!
    This is an email to myself.

    Hope all is well.
    ...

and terminate with ^D.

or

echo "this is a test mail" | mail -s'send mail test' testuser@somewhere.com

Using mailx

mailx -s "subject" -r sender@somewhere.com receiver1@somewhere.com,receiver2@somewhere.com < textfile

Using mailx with attachment

mailx -A attchment_file -s "subject" -r sender@somewhere.com receiver1@somewhere.com,receiver2@somewhere.com < textfile

Test what's happening

tail -f /var/log/mail.log