Monday, August 1, 2011

Sending mail using 'mutt' from shell

In my opinion, 'mutt' is the best text-based Email client for sending mails with Attachment from Linux shell. The best part with it is, it supports wide variety of MIME ("Multipurpose Internet Mail Extensions") types, which ensures the integrity of various types of attachments such as Binary, jpeg, mp3 files.

Below shown are few command sets for sending mails using Mutt with following specifications.
Subject: Test mail
Attachment filename:  song.mp3
Message body:  "This mail has a mp3 attachment"

With attachment:
# echo "This mail has a mp3 attachment" | mutt -s "Test mail" -a song.mp3

# mutt -s "Test mail" -a study.dat < messagefile 
Note: "messagefile" is the filename that contains the message body "This mail has a mp3 attachment"

Without attachment:
# echo "Mail without attachment" | mutt -s "Test mail"

Without Message body:
# mutt -s "Test mail" -a study.txt < /dev/null

1 comment:

  1. Hello there! I could have sworn I've been to this website before but after going through a few of the articles I realized it's new to me.
    Anyhow, I'm certainly happy I found it and I'll be bookmarking it and checking back frequently!

    Feel free to visit my blog online pay day loans