Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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.