Not able to send multiple attachments using uuencode and mailx

Hi,
I am seeing some junk characters when I attach the second file, given below is the logic I used. Please help me resolving the issue.

( uuencode file1.txt file1.txt.lst && uuencode file2.txt file2.txt.lst )  > attachment.txt
cat body.txt attachment.txt > combinemail.txt
mailx -m "Subject text" mailIDFile.txt < combinemail.txt

Thanks
Prasanna

You can use the following command to attach the two files using mail command.

(uuencode  <filename1> <filename1> ; uuencode <filename2> <filename2>) | mailx -s "SUBJECT" <EMAILID> 

I tried it too, but facing the same issue

(cat body.txt; uuencode  <filename1> <filename1> ; uuencode <filename2> <filename2>) | mailx -s "SUBJECT" <EMAILID>

What your body.txt contains? Will body.txt contains body of the mail?

I tried your code in my system.It is working perfectly.

(cat body.txt; uuencode  <filename1> <filename1> ; uuencode <filename2> <filename2>) | mailx -s "SUBJECT" <EMAILID>

We can also specify subject to the mail using echo command as follows.

(echo "Body of the Mail"; uuencode  <filename1> <filename1> ; uuencode <filename2> <filename2>) | mailx -s "SUBJECT" <EMAILID>

Think there might be a bug on my mail server (Lotus notes) not able to decode multiple attachments. Referred the following link.
http://linux.die.net/man/1/uuencode.

Tried the following in the command prompt, but still giving junk characters for the second file
uuencode first first.txt | uuencode second second.txt.| mailx -s "Sub " mailid
(first and second are valid files)

Please let me know if it can be resolved.
Thanks,
Srivatsan

uuencode doesn't work on all mail agents.
e.g: usually it's ok on solaris but not on typical linux

We don't know what Operating System or Shell you have, but try this:

Convert the text file from unix to MSDOS format before uuencode. On some unixes the program is called "unix2dos" not "ux2dos".
Also consider keeping the attachment filenames within valid MSDOS 8.3 format (XXXXXXXX.txt).

(cat body.txt; ux2dos <filename1> | uuencode  <filename1> ; ux2dos <filename2> | uuencode <filename2>) | mailx -s "SUBJECT" <EMAILID>