Showing results for 
Search instead for 
Did you mean: 

Send attachments using sendmail.

Raghu Chikkamenahalli
Frequent Advisor

Send attachments using sendmail.

I have a written a shell script to
send e-mails using multiple attachments ( usign uuencode). Interestingly when an
ms-excel files are sent as attachments, the format will be intact, but when a text file (files) is sent as an attachment, it will remove the format.

Kindly show some light on how this can be retained.

Note: My script is as follows.
echo "From:" > "MESSAGE_FILE"
echo "To:" >> "MESSAGE_FILE"
echo "Subject: Report" >> "MESSAGE_FILE"
echo "Content-type: multipart/mixed >/dev/null
echo "" >> "MESSAGE_FILE"
echo "" >> "MESSAGE_FILE"

uuencode ${FILE} ${FILE}>>${MESSAGE_FILE}

cat MESSAGE_FILE|/usr/sbin/sendmail -t

Or is it possible to use any other method in sendmail header.

Many Thanks,
Steven Schweda
Honored Contributor

Re: Send attachments using sendmail.

Have you considered using a real MIME
program, like, say, mpack?

A forum search for something like
e-mail attachment
may find some of the many old threads
covering this topic.
Respected Contributor

Re: Send attachments using sendmail.

Pipe the uuencode to mailx as follows.

uuencode ${FILE} ${FILE} |
mailx -m -s "subject" email@address

Works for me on HPUX. Note take out the -m option on other flavours of unix.

The Devil is in the detail.