Operating System - HP-UX
1752806 Members
5588 Online
108789 Solutions
New Discussion юеВ

Send attachments using sendmail.

 
Raghu Chikkamenahalli
Frequent Advisor

Send attachments using sendmail.

Hi,
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.
++++++++++++++++++++++++++++++++++++++++++++++
FILE="file_rpt.txt"
echo "From: raghu@abc.com" > "MESSAGE_FILE"
echo "To: raghu@xyz.com" >> "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,
Regards,
Raghu.
2 REPLIES 2
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.
OFC_EDM
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.