The simplest way to send a file as a mail attachment is shown by the following examples:
# uuencode snoopy1.jpeg snoopy1.jpeg | mail email@example.com
If user uses a current mail reader like Mozilla, Netscape Messenger or Microsoft Exchange, she/he will see a mail containing just one file attachment: the file “snoopy1.jpeg”.
This way we can include text, too:
# (cat mailtext; uuencode snoopy1.jpeg snoopy1.jpeg) | mail firstname.lastname@example.org
The file called “snoopy1.jpeg” again appears twice on the uuencode command line: the first time to specify the input file name, the second time for the remote extraction file name.
echo -e "text in line1 ntext in line2"| mail -s "Subject of an e-mail" -r "User1<email@example.com>" -a "/tmp/abc.zip" firstname.lastname@example.org