Commons Email
  1. Commons Email
  2. EMAIL-125

DataSourceClassPathResolver on ImageHtmlEmail with multiple image in template don't work

    Details

      Description

      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.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Jean-Marc
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3h
              3h
              Remaining:
              Remaining Estimate - 3h
              3h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development