Monday, May 9, 2011

Send email with attachment from Linux command prompt


You can use following command to send an email with attachment:
# mutt -s "Email subject" -a /home/ali/filename emailaddress@domain.com < /home/ali/mailmessage.txt

where:

emailaddress@domain.com is the recipient's email address.
/home/ali/mailmessage.txt  is the main body of the email.
/home/ali/filename is file that will be sent as attachment (using -a switch).
"Email subject" is your email's subject (switch -s).

If you dont have mutt installed, you can install it by using command:
# yum -y install mutt

No comments:

Post a Comment