Jean-Marc created EMAIL-125:
-------------------------------

             Summary: 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


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

Reply via email to