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("xx...@gmail.com","Admin")); msg.addRecipient(Message.RecipientType.TO,"xx...@gmail.com"); 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 google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.