lundi 22 août 2011

UNIX SHELL: send a mail with an attachment

UNIX SHELL: send a mail with an attachment

So, i found an old tips, and i wanted to write here.

To send a mail with an attachment, with the plain old mail command:

you need:

uuencode
gzip
mail


General Form:

uuencode <binary_file> | mail -s"Subject" <recipient>

Example:

gzip -c9 2308cc1fi02.dat            |\
    uuencode cc1fi02.dat.gz         |\
    mail -s "My Import File" samplemail@domain.com

6U


Aucun commentaire: