Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Sending Email from the Command Line

May 11, 2023 — Gregg Szumowski

mutt Examples

Sending just a file attachment (-a) and an empty message body:

$ mutt -s "System logs" -a /opt/backup.sql -- user@example.com < /dev/null

Sending a message body using redirection:

$ mutt -s "Email subject" test@example.com < email.html

Sending a file attachment along with a message body:

$ echo $message | mutt -s "Subject" -a attachment.txt -- me@myemail.com

mailx Example:


$ echo "message body" | mail -s "subject" test@example.com

Tags: mail, mutt, motd