How do you sent a mail attachment via bash console ?

“mutt” is an opensource tool for sending emails with attachments from the linux bash command line. We can install “mutt” from the binary rpm or via packagemanager.

For Ubuntu / Debian based destros.

# apt-get install mutt

For Redhat / Fedor based destros,

# yum install mutt

Usage :

# mutt -s “Subject of Mail” -a “path of attachment file” “email address of recipient” < “message text containing body of the message”

Eg : mutt -s “Backup Data” -a /home/backup.tar.gz admin@mywebsite.com < /tmp/message.txt