2011-11-23

how to send attachment from linux coomand line

A very good article : http://www.cyberciti.biz/tips/sending-mail-with-attachment.html

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 vivek@nixcraft.co.in < /tmp/mailmessage.txt
Where,
  • vivek@nixcraft.co.in - 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 .

Niciun comentariu:

Trimiteți un comentariu