Wednesday, October 23, 2013

send email with attachment from linux command line

You can send email with attachment from linux command line using uuencode. Make sure you have the package installed.

Command:

(echo "Please find the attached log"; uuencode /tmp/todaylogs.zip todaylogs.zip;) | mail -s "Server logs" someone@mycompany.com


The command structure:

(echo "Email body"; uuencode attachment-file new-attachment-filename-or-same-name-as-source;) | mail -s "Subject" someone@mycompany.com





No comments:

Post a Comment