servlets - JavaMail: inline images generated incorrectly -


I've coded down the servlet, which Responds to an email in email format (using javaMail). Browser detects mime type and opens an email app (Microsoft Live in my case) When the response is received "X-Unsent" is set to "1", so when email is opened, edit it and can be sent.

Email content is HTML with an image inline when I open the generated email so I can see the content with no problem. But when I enter an address and try to send an email, I get the message "One or more images could not be found, do you want to continue?" I send it anyway and when I check the e-mail recipient's account, the email is received, but instead of being inline in the image, it is attached. It seems that there is something wrong with the way inline images are generated. Any ideas?

  Safe void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {response.setContentType ("message / rfc822"); Response.setHeader ("Content-Disposal", "Attachment; Filename = \" email.eml \ ""); PrintWriter out = response.getWriter (); String eml = null; Try {Message Message = New MimeMessage (session .get instance (System.getProperties ()); message.addHeader ("X-Unsent", "1"); message.setSubject ("email with inline image"); // 2 parts of this mail, body and embedded image MimeMultipart multipart = new MimeMultipart ("related"); // First part (HTML) BodyPort MessageBodyPart = New MimeBoopyPart (); String htmlText = "& lt; H1> This image is:     

Try this simple version that can fix the problem: // First part (HTML) MimebodeePartite MessageBodyPart = New MimeBoopyPart (); String htmlText = "& lt; H1> This image is:

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -