Need to export a file from Unix/Linux via email? Got uuencode? Do you even remember uuencode? It's how we used to encode files for file sharing, back before you were born.
Here's a handy one-liner that will wrap your file up as a UUEncoded attachment and mail it to the address you specify. The email should come through with a properly formatted attachment that you can then download.
Just do this:
% cat file.zip | uuencode file.zip | mail firstname.lastname@example.org
Or you can get a bit fancier and add a subject line and a proper from address (if your system doesn't add one already):
% cat file.zip | uuencode file.zip | mail -s "Export of file.zip" -a "From: Me <email@example.com>" firstname.lastname@example.org
Or you can do it as part of a shell script, with bits that look something like this:
FROM="Just Me <email@example.com>"
cat $FILE | \
uuencode $FILE \
mail -s "Export of $FILE attached" \
-a "From: $FROM" \
I know there's probably some better way to do this, but this simple example has saved me endless amounts of time lately. Hope you find it useful, too.