Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attaching multiple files to an email

Status
Not open for further replies.

IMAUser

Technical User
May 28, 2003
121
0
0
CH
Hi ,

I have a file which contains the list of files which need to be attached to an email. I had the following piece of code which was working fine. What it did was

ADDR=myname@domain.com
DLY_REP="History Report "
TEMP=$TMPDIR/rpi_history.out
{
echo "To: $ADDR"
echo "Subject: $DLY_REP"
echo "X-Priority: 3"
echo "MIME-Version: 1.0"
echo "Content-Description: $FILENAME"
echo "Content-Disposition: attachment;"
echo " filename=\"$FILENAME\""
echo
echo "Please find attached histories"
echo ""
} > $TEMP

if [[ -e $LISTOFRPIFILES ]] then
for i in `cat $LISTOFRPIFILES`
do
OUTFILE_SIZE=`wc -l $i | awk ' { print $1 } ' `
## Get the name of the file from the string ending in .xml
SENDFILE=`echo $i | nawk ' { print substr($0, 6, match($0,"xml") + 4 ) }'`

# set -xv
if [[ $OUTFILE_SIZE -gt 10 ]] then
{
unix2dos $i $i
uuencode $i $SENDFILE
} >> $TEMP
fi
done
fi

if [[ `wc -l $TEMP | awk '{ print $1 } ' ` -gt 15 ]] then
/usr/lib/sendmail $ADDR < $TEMP
fi

And this used to send me an email with about 8 attached files.

For some reason ( which I cant figure out now) it has started sending me just one file which includes all the 8 files and the text is gibberish. I can see my subject line "Please find attached histories" and then a
begin 644 OneOfTheFilenames.xml
gibberish...
........
end
begin 644 SecondFilename.xml
gibberish......
..........
end

And so on...

What I fail to understand why has this started happening all of a sudden and secondly what shld I change to bring it back to normal.
Please help.


Thanx
 
I would suggest that there is something changed in your email client(how to handle uuencoded messages).

The block
begin 644 filname
gibberish
end

is the normal way files get attached to emails, ie as uuencoded textblocks (or mime encoded...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top