Sending an email with a body and attachments using uuencode

Hi,

Im having a bit of an issue with using the uuencode command and sending out an email.

My aim is to send an email out which has a body and also have attachments. Currently I can either get one or the other and not both on the same email.

 
uuencode /apps/Backup_Verification/DB_Structure_Files_AB/main.txt Main_prorest.txt > /apps/Backup_Verification/tmp/out.mail
uuencode /apps/Backup_Verification/DB_Structure_Files_BB/main.st Main_structure.txt >> /apps/Backup_Verification/tmp/out.mail
 
cat /apps/Backup_Verification/email-body.txt >> /apps/Backup_Verification/tmp/out.mail
 
/usr/local/bds/mailsend.s mailx "Backup Verification" <email address> <email address> /apps/Backup_Verification/tmp/out.mail

This just ignores the body and creates an email with the 2 attachments

Any help will be much appreciated as Ive been stuck on this for ages :slight_smile:

What's your OS, uname -a ?
uuencode should take two arguments or must read from stdin.
uuencode is not compliant with MIME attachments, so is visible in the body text by most mail readers.
How do you read the mails?

SunOS awards-live 5.10 Generic_137111-07 sun4u sparc SUNW,Sun-Fire-V890

I read the emails in outlook 2010 (HTML) - attachemnts show fine but the body of the email is blank

I am a bit surprised. Perhaps your /usr/local/bds/mailsend.s converts uuencoded sections to MIME.
Try to switch the order, mail-body.txt first, then the uuencode statements.
Remember that the first write to the output file must overwrite with > and following writes must append with >>

1 Like

Thats brill!!! thankyou :slight_smile:
Just switching the order around has worked perfectly :slight_smile: