[GLLUG] mail two files

Matt Graham danceswithcrows@usa.net
Mon, 28 Jan 2002 14:07:21 -0500


On Monday 28 January 2002 11:05, Charles Williams wrote:
> I want to mail two files to myself.
> This is how I mail one file:
> mail willcha@sme.org < file_one.txt
> It seems I should be able to stick another file on there but I can't.
>
> Kinda like
> mail willcha@sme.org < file_one.txt < file_two.txt
> Any ideas?

When you use < to mean "redirect STDIN" like that, you can only use it 
once.  Also, you can only use it with one file.  If these things are 
text files, you can do this:

cat file1.txt file2.txt > temp.txt
mail foo@example.org < temp.txt
rm -f temp.txt

If you have non-text data you wish to send, you can tar + gzip the 
files, then pipe the output to mmencode (or uuencode) and pipe that to 
mail, kind of like so:

tar czO file1 file2 file3 | mmencode | mail -s "some files" foo@bar.org

There's another command-line program called "metasend" that should also 
work, but it's kind of hairy and ugly.  It would go like so:

metasend -b -s "some files" -t foo@bar.org -D "file1" -m text/plain -e 
base64 -f file1 -n -D "file2" -m text/plain -e base64 -f file2

This way you can get more than one file attached, but the output looks 
ugly and incorrect (though all the data is there.)  I probably have the 
metasend syntax partially wrong.

-- 
   You should emulate your heros, but don't carry it too far. Especially
   if they are dead.
There is no Darkness in Eternity/But only Light too dim for us to see