[
https://issues.apache.org/jira/browse/EMAIL-125?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Neidhart resolved EMAIL-125.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.3.1
Fixed in r1448981.
The problem existed because the DataSourceClassPathResolver created special
DataSources that did not have a name set.
The result was that each resource loaded by this resolver had the same name,
and thus the cids where all equal.
> DataSourceClassPathResolver on ImageHtmlEmail with multiple image in template
> don't work
> ----------------------------------------------------------------------------------------
>
> Key: EMAIL-125
> URL: https://issues.apache.org/jira/browse/EMAIL-125
> Project: Commons Email
> Issue Type: Bug
> Affects Versions: 1.3
> Environment: Windows7, Jdk 1.7
> Reporter: Jean-Marc
> Priority: Critical
> Labels: DataSourceClassPathResolver, ImageHtmlEmail
> Fix For: 1.3.1
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> I'm having a html template for sending with 3 images.
> If I resolve the images using DataSourceClassPathResolve, only the first is
> replaced. The 2 others have same cid and thus are replaced by the first.
> Using others DataSource resolver leads to the good result.
> Here is more details :
> The template : <p>Une image en relatif <img src="testu/info.png"/></p><p>Une
> image en relatif <img src="testu/warning.png"/></p><p>Une image en relatif
> <img src="testu/error.png"/></p>
> The code :
> ImageHtmlEmail email = new ImageHtmlEmail();
> email.setDataSourceResolver(new DataSourceClassPathResolver("/images/",
> true));
> email.setHostName(...);
> email.setCharset("utf-8");
> email.addTo(...);
> email.setFrom(...);
> email.setSubject(...);
> email.setHtmlMsg(corps /* ie the template above */);
> email.setTextMsg("Your email client does not support HTML messages");
> email.send();
> The result (source of the received mail) :
> <p>Une image en relatif <img src="cid:afgsltqedp"/></p><p>Une image en
> relatif <img src="cid:afgsltqedp"/></p><p>Une image en relatif <img
> src="cid:afgsltqedp"/></p>
> You will notice that all cid are the same. The lenient flag is true so I'm
> sure that all images are present on classpath.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira