Tuesday, July 24, 2012

How to send an email with attachment from command line in unix?


How to send the email with attachment from command line?


This is useful when one is working remotely and does not have access to any mailing programs other than command line.
Install following programs on Ubuntu as followed
sudo apt-get install mailx sendmail
sudo apt-get install sharutils

We can use following command to actually send the email. 

 [user@machine~]$ uuencode FileWithExtention FileWithExtention | mailx -s 'Subject' user_name@domain

This page provides more information.

No comments:

Post a Comment