email sending not success when pdf file as attachment .

225 views
Skip to first unread message

Manoj Kumar

unread,
Feb 4, 2013, 4:33:58 AM2/4/13
to google-a...@googlegroups.com
Dear Sir/Madam,
      I am Manoj Kumar working in a software company. we are accessing  the services from  google app engine in our project. we are registered withgoogle co-operation.Sir, When i am trying to mail the  pdf file  using "https://developers.google.com/appengine/docs/java/mail/usingjavamail" docs , Mail is not sending (No error 
coming while compilation ). 

This is given code:
import javax.activation.DataHandler;
import javax.mail.Multipart;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;

// ...
       
String htmlBody;        // ...
       
byte[] attachmentData;  // ...

       
Multipart mp = new MimeMultipart();

       
MimeBodyPart htmlPart = new MimeBodyPart();
        htmlPart
.setContent(htmlBody, "text/html");
        mp
.addBodyPart(htmlPart);

       
MimeBodyPart attachment = new MimeBodyPart();
        attachment
.setFileName("manual.pdf");
        attachment
.setContent(attachmentData, "application/pdf");
        mp
.addBodyPart(attachment);

        message
.setContent(mp);



If We send the attachment Data Directly as a String 

      String Str="Hi , Testing! ";
  attachment.setContent(Str, "application/pdf");


then ,

      Pdf file is attached to mail, But when i am opening that file after download , giving error "Unable to open document . File type plain text document (text/plain) is not supported"


please let us know ,How to  mail pdf file as attachment using google app engine.

---
Thanks and Regards
S.Manoj Kumar,

Manoj Kumar

unread,
Mar 1, 2013, 9:42:19 PM3/1/13
to google-a...@googlegroups.com

Hi .. Thank You .



On Friday, March 1, 2013 9:37:25 PM UTC+5:30, Ramanjaneylu wrote:
http://vangjee.wordpress.com/2010/11/02/how-to-create-an-in-memory-pdf-report-and-send-as-an-email-attachment-using-itext-and-java/

Hi Manoj, Go through this link it will solves your problem.
Reply all
Reply to author
Forward
0 new messages