How to send existing email html including images

I used the JasperReport to generate a report in html formats.

The html page(containg the data) has a lot of images.

I need to send the html report by emails with the images saved in local drive.

So I used MineMulitipart way, but in existing ways the html part is just a few lines, you can define yourself.

For my stiuation, the html is already there and very complicated,contain mulitiple images.

How do I solve the problem still using MineMulitipart?

Thanks!

[503 byte] By [Nanakoa] at [2007-11-27 10:14:19]
# 1

you basically have 2 options for images in HTML emails:

Option 1) you can embed them as file attachments and reference them with no path (only the file name) in the img tag. This is good because the recipient will see the images even if he does not have an internet connection. But this is bad for several reasons: Each email will be large since it contains several attachments, thus large traffic on your SMTP server if the volume is high. Also, many email clients might not support this configuration. I would not normally recommend this option for these reasons, but sometimes this method can be prefferable if the recipient's email client is known to support it (Outlook, Outlook Express), and if the recipient is behind a firewall and does not have internet access.

Option 2) the other, (preferrable) option is to serve the images on a publicly available web server, preferrably on port 80. Reference each image with an absolute URL to the file.

Also note you should attach a .txt Multipart for those email clients which do not support HTML. (pine or elm users stuck in 1987). Note there are issues with mail gateways, as well as different levels of HTML support within the email client itself... mail clients won't support JavaScript either.

...good luck!

i_program_java_all_daya at 2007-7-28 15:32:36 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

The JavaMail FAQ also answers this frequently asked question:

http://java.sun.com/products/javamail/FAQ.html#sendmpr

bshannona at 2007-7-28 15:32:36 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...