dcsimg
How do I send an HTML document as an email attachment with images included.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Christopher_Lupton
Posted On:   Thursday, September 18, 2003 11:46 AM

I need to know if it is possible to take an HTML page and send it via JavaMail as an Attachment. The real problem is that the HTML page has a few images on it. (These images are somewhere on the Web Server of course). However, the people that will be getting the email will NOT be allowed access to the Images. So just including the Image Links that point back to my Web Server will not suffice. If they are going to see the Images, they need to recieve them inside the email that contains the attachment. Im not sending this as a HTML email because alot of places disable HTML emails due to security issues etc. etc. I need to maintain the "pretty" formatting and images that a person sees when viewing the HTML document a   More>>

I need to know if it is possible to take an HTML page and send it via JavaMail as an Attachment. The real problem is that the HTML page has a few images on it. (These images are somewhere on the Web Server of course).

However, the people that will be getting the email will NOT be allowed access to the Images. So just including the Image Links that point back to my Web Server will not suffice. If they are going to see the Images, they need to recieve them inside the email that contains the attachment.

Im not sending this as a HTML email because alot of places disable HTML emails due to security issues etc. etc.

I need to maintain the "pretty" formatting and images that a person sees when viewing the HTML document as if they were having it served to them directly from the Web Server. But the recipient will not have access to the Web Server.

I really enjoy the JGuru JavaMail FAQ. Very indepth articles. Very nice. But if the answer is there to my question, then I must not have understood it's importance.

If there is a solution, does anyone know if the solution will work across all Email Clients or if it will only work on some of them ? I need to try to find out if there is a solution that will work for a large percentage of recipients.

   <<Less

Re: How do I send an HTML document as an email attachment with images included.

Posted By:   Scott_Smith  
Posted On:   Monday, October 6, 2003 09:29 AM

In your HTML image tag, set your src="cid:IMAGEIDENTIFIER".

On your body part that contains the HTML set the Header up like this:

BodyPart.setHeader("Content-ID","<"+IMAGEIDENTIFIER+">");
About | Sitemap | Contact