Search code examples
email-attachmentssusemailxuuencode

Mailx with uuencode not sending multiple attachments with a proper email body on Suse Linux


This particular piece of code below worked correctly on AIX

( echo "mailbody";
  uuencode a.txt 'arenamed.txt';
  uuencode ab.txt 'abrenamed.txt';
  uuencode abc.txt 'abcrenamed.txt';
  uuencode abcd.txt 'abcdrenamed.txt'; ) | mailx -s "$subject" $emailaddress;

But on Linux, any occurrence of uuencode is printing begin 644 blocks in the body of the email viewed on Outlook 2010.

begin 644 abc.txt
5:F%H<V1L:G-A"F%S9&MJ87-J9#L*
`
end

I have tried, using different variations of ( echo $body ; uuencode filename filenamechanged ) with echo first, uuencode later and vice versa but it doesn't help. I would have used "mail -a" but I want to rename files which are emailed, so, was looking at uuencode.

Any suggestions other than using sendmail/mutt here?


Solution

  • This is what worked

    (echo "Subject: $Mail_Subject";
    echo "To:$Mail_List";
    echo $Mail_Body;
    uuencode $LOG_DIR/FileName1 'AttachmentDisplayName1';
    uuencode $LOG_DIR/FileName2 'AttachmentDisplayName2') | sendmail -t $Mail_List
    

    Hope this helps anyone who is looking for this kind of issue.