I've successfully sent attachments using this lib:

http://code.google.com/p/app-engine-workarounds

But make sure to apply the patches (fix for plain/text attachments and
attachment's file names) I provided here (It's on the issue tracker
for a long time):

http://code.google.com/p/app-engine-workarounds/issues/detail?id=3
http://code.google.com/p/app-engine-workarounds/issues/detail?id=4


On Sep 3, 1:25 pm, yangyang <[email protected]> wrote:
> I have following the sample code, and it works somehow.  But not as I
> expected: (dummy code are omitted.)
>
>                         Multipart mp = new MimeMultipart();
>                         MimeBodyPart attachment = new MimeBodyPart();
>                         byte[] attachmentData = "<html><h1>hello world<h/1></
> html>".getBytes();
>                         ByteArrayDataSource src = new ByteArrayDataSource
>                                         (attachmentData, "application/html");
>                         attachment.setDataHandler(new DataHandler(src));
>                         attachment.setFileName("news.html");
>                         mp.addBodyPart(attachment);
>                         message.setContent(mp);
>                         Transport.send(message);
>
> I have use the same code in my local console test code, it will send
> out the file as a real "attachment".
> But if I drop this code to GAE, then there will be no "attachment"
> present, instead, the main content itself will be the HTML escaped
> original data.
>
> I guess the implementation on GAE are using some automatically escape
> process to be secure.
>
> But why the attachment itself is send as the main body?  How can I
> send out a attachment?  Thanks!
>
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to