Send Email from Terminal with file attachment using mutt

Sometimes I run into situation where I need to email a file, and I am lazy to open a browser, login to my email account, and then attach file and send it.

If you are like me, then mutt is a neat command for sending emails from terminal quickly =P.

The code looks like below:

echo "email body" | mutt emailaddress@gmail.com -s "email subject" -a "file-to-be-attached"

So, if I need to email a file code.zip (in the same directory), I would use the following:

echo "Code for Project" | mutt email@gmail.com -s "project c" -a "code.zip"

Check out man mutt for more information. Hope it helps out.