There are a few threads about forwarding emails with attachments here:

http://groups.google.com/group/google-appengine-java/browse_thread/thread/34fc6354a923e6af/3292bcd1535394a4?lnk=gst&q=attachment+incoming#3292bcd1535394a4

http://groups.google.com/group/google-appengine-java/search?group=google-appengine-java&q=attachment+incoming&qt_g=Search+this+group

The code in those posts *should* still be working. We made a change to how
inbound emails were handled, but I don't believe it's broken any of that
code.

On Mon, Aug 9, 2010 at 8:43 PM, witiProg <[email protected]> wrote:

> Hi every body
> Sorry for my english.
> I'm tryn to fetch an image from url, and then send it via mail;
> this is my code:
>
> String url = "http://www.google.co.ve/images/firefox/
> globe_getinvolved.png"
> String contenttype ;
>
> URL myurl = new URL(url);
> HttpURLConnection conn = (HttpURLConnection) myurl.openConnection();
> contenttype = conn.getContentType();
> Object image = conn.getContent();
> Message msg = new MimeMessage(session);
> msg.setFrom(new InternetAddress("[email protected]","Admin"));
> msg.addRecipient(Message.RecipientType.TO,"[email protected]");
> msg.setSubject(url);
> MimeBodyPart ad = new MimeBodyPart();
> ByteArrayDataSource src = new
> ByteArrayDataSource((InputStream)image,contenttype);
> ad.setDataHandler(new DataHandler(src));
> Multipart mp = new MimeMultipart();
> mp.addBodyPart(ad);
> msg.setContent(mp);
> Transport.send(msg);
>
>
> The problem is when i do the cast to the object
> 'image' (InputStream)image ; How can i do to convert the result of the
> conn.getContent(); to an InputStream or to a byte[].
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.

Reply via email to