Dear Friends,
i have been trying to send emails with html content and images in such a manner that the images are attached and the images in the main email link to the attached image. i have tried the following code but i am unable to establish the link.
Please help
the code is:
// basic message has been created
MimeMultipart multipart = new MimeMultipart("related");
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart = new MimeBodyPart();
String htmlText = "<html><H1>Hello</H1>" +
"
</html> ";
messageBodyPart.setContent(htmlText, "text/html");
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
URL aurl=new URL("http://www.google.com/");
URL burl=new URL(aurl,"logo.gif");
DataSource fds = new URLDataSource(burl);
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setHeader("Content-ID","memememe");
multipart.addBodyPart(messageBodyPart);
msg.setContent(multipart);
Transport.send(msg);
this is from a jsp page im trying to use
the final email has the image attached but does not show it in the final email's html content.
Please help
DS