Dear Sir/Madam,
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,