Sendmail attachment problem on Gmail

Hi.

I am a user on HP-UX , OS Version 11.23 with the Itanium architecture.

I am using a script on HP-UX to send emails that include a Pdf attachment to clients. The scipt makes use of sendmail.

The scripts works for everything except gmail. When I go on gmail via my Web Browser, I can see the message with the attachment, but if I try to view or download the attachment, gmail tells me that the attachment cannot be found at its original source.

If I use this same script to send the mail to my hotmail account or my work email, everything is fine.

Can somebody please help? The script is shown below.

echo "From: ${MAIL_FROM}" > $MSG_FILE
echo "To: ${MAIL_TO}" >> $MSG_FILE
echo "Subject: ${SUBJECT}" >> $MSG_FILE
echo "MIME-Version: 1.0" >> $MSG_FILE
echo 'Content-Type: multipart/mixed; boundary="--_GvXjxJ+pjyke8COw"' >> $MSG_FILE
echo " " >> $MSG_FILE
echo "----_GvXjxJ+pjyke8COw" >> $MSG_FILE
echo "Content-Type: text/plain; charset=ISO-8859-1" >> $MSG_FILE
echo "Content-Disposition: inline" >> $MSG_FILE
echo " " >> $MSG_FILE
cat $BODY_FILE >> $MSG_FILE
echo " " >> $MSG_FILE
echo "----_GvXjxJ+pjyke8COw" >> $MSG_FILE
echo "Content-Type: application/octet-stream" >> $MSG_FILE
echo "Content-Disposition: inline; filename=${ATT_FILE_NAME}" >> $MSG_FILE
echo "Content-transfer-encoding: X-UUencode">>${MSG_FILE}
echo " " >> $MSG_FILE
/usr/bin/uuencode ${ATT_FILE} ${ATT_FILE} >> ${MSG_FILE}
echo " " >> $MSG_FILE
echo "----_GvXjxJ+pjyke8COw--" >> $MSG_FILE
echo " " >> $MSG_FILE
/usr/lib/sendmail ${MAIL_TO} < ${MSG_FILE};EXITSTATUS=$?
 

What are the values of these two variables?

Quote:
${ATT_FILE_NAME}
${ATT_FILE}

Hi Methyl.

Thanks for your reply.

The $(ATT_FILE) might be something like /tmp/in1201cx12345.pdf.
The $(ATT_FILE) will then simply be in1201cx12345.pdf.

---------- Post updated at 06:26 PM ---------- Previous update was at 06:24 PM ----------

Hi Methyl.

Sorry, I made a mistake with the prvious reply. Here are the correct answers:

The $(ATT_FILE) might be something like /tmp/in1201cx12345.pdf.
The $(ATT_FILE_NAME) will then simply be in1201cx12345.pdf.

Not tried with gmail, but suggest you try removing absolute paths from the mail message and also make the attachment filename consistent with the MIME header.

echo "Content-Disposition: inline; filename=${ATT_FILE_NAME}" >> $MSG_FILE


/usr/bin/uuencode ${ATT_FILE} ${ATT_FILE_NAME} >> ${MSG_FILE}

Hi Methyl.

Thanks again for your reply.

I tried your suggestion, but the results were the same. However, I found the solution.

The problem was in the following lines: (I don't know why it was a problem):

echo " " >> $MSG_FILE

The lines should have read:

echo "" >> $MSG_FILE

I removed the space between the quotes and now I can open the pdf attachment on gmail, hotmail, work email, webmail for my home email, etc.