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