You must have mutt installed
Use mutt command as follows to send an email with attachment:
$ mutt -s "Test mail" -a /tmp/file.tar.gz firstname.lastname@example.org < /tmp/mailmessage.txt
- email@example.com - is the recipient
- /tmp/mailmessage.txt - is the main body of the e-mail (read message from the file "mailmessage.txt")
- /tmp/file.tar.gz - is an attachment (with option -a)
- "Test mail" - is a subject line (option -s)
Another way is to use uuencode and mail ... but uuencode takes more time .