Sendmail attachment problem on Gmail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sendmail attachment problem on Gmail
# 1  
Old 06-06-2012
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.

Code:
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=$?


Last edited by joeyg; 06-06-2012 at 12:35 PM.. Reason: Please wrap commands and data with CodeTags
# 2  
Old 06-06-2012
What are the values of these two variables?
Code:
Quote:
${ATT_FILE_NAME}
${ATT_FILE}

# 3  
Old 06-06-2012
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:

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


Last edited by methyl; 06-06-2012 at 03:55 PM.. Reason: please use code tags
# 4  
Old 06-06-2012
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.

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


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

# 5  
Old 06-07-2012
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):

Code:
echo " " >> $MSG_FILE

The lines should have read:
Code:
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with attachment in sendmail

Hi Folks I have below code, which is able to successfully send the content of the output file as html which is body, but i did tried uuencode & mailx -a for sending attachments but to no avail. cat - ${Output_File} <<EOF| /usr/sbin/sendmail -oi -t #From: ${MAILFROM} To: ${MAILTO} Subject:... (5 Replies)
Discussion started by: nikhil jain
5 Replies

2. Web Development

Gmail very slow to receive Sendmail/PHP Mail

Okay, I have searched the forums and couldn't really find a topic on this, so I decided to start one. But I decided to start a ncurses discussion forum recently and one thing I noticed while getting it going is that when mail is sent out via Sendmail or PHP Mail, Gmail is /very/ slow to receive it.... (2 Replies)
Discussion started by: Phobos D'thorga
2 Replies

3. Shell Programming and Scripting

Sendmail with attachment

Hello people, I only have sendmail and uuencode on a Oracle (RH) linux server. While: /usr/bin/uuencode awr.html awr.html | /usr/sbin/sendmail myemail@company.com Is working fine, the ideal for me is to do something like: echo "To: me@company.com" > /home/vasilis/msg.txt echo "Subject: DB... (3 Replies)
Discussion started by: drbiloukos
3 Replies

4. Shell Programming and Scripting

Send attachment through sendmail

Hi, I am trying to send log file of a job run in unix machince through sendmail.Though I am able to send the text but it is not sending as attachment. Could you please look into the code and let me know where I have gone wrong fdate=`date %Y%j`... (2 Replies)
Discussion started by: Rossdba
2 Replies

5. Shell Programming and Scripting

sendmail with attachment not working

dear all I have below function which send an email, but if I need to add an attachement it won't work instead it write some jibberish to body of the email begin 644 SIGN_OFF_AP_20120626.csv M4TE'3E]/1D9?4TA%150L351-7T1!5$4L0D]/2RQ35$%455,L5D%25%E012Q# %3U5.5`H` ` end function... (6 Replies)
Discussion started by: manas_ranjan
6 Replies

6. Shell Programming and Scripting

Sendmail Script: Gmail cannot find attachments

Hi. 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... (2 Replies)
Discussion started by: Wahooka
2 Replies

7. Shell Programming and Scripting

Problem in sending inline html with an attachment using sendmail

MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=border --border Content-Type: text/html Content-Disposition: inline <html><body><h2>This text should be displayed with html formatting</h2></body></html> --border Content-Type: text/plain Content-Disposition: attachment This text... (2 Replies)
Discussion started by: thulasidharan2k
2 Replies

8. UNIX for Dummies Questions & Answers

sendmail attachment problem

Hello, i am sending email with following command. The problem is the attachment is displayed as inline text instead of a file attached to email. What should i do? I don't have chance to install new binaries to the server (SunOS) ( \ echo From: Sender ; \ echo Subject: Testing ; \... (1 Reply)
Discussion started by: yakari
1 Replies

9. UNIX for Dummies Questions & Answers

Using Sendmail (& attachment)

Hi, This is my first thread. Iam trying the following: OS: Sun Database: DB2, Informix, Oracle * Get the status of the database (using database command line options) * pipe to a text file * send mail of the text file to receiptents. TODO1: First step i tried to send a test message.... (3 Replies)
Discussion started by: kenkanya
3 Replies

10. Solaris

attachment using sendmail

Hi, I use the sendmail command to send automatic e-mail in my control programs, but I'd like to know if there's a non interactive way to send an attachment, like a small text file through sendmail command. I didn't find a way in the man, so anyone has already done it?.. give an example for the... (4 Replies)
Discussion started by: vastare
4 Replies
Login or Register to Ask a Question