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

        Jean-Marc created issue -
        Hide
        Thomas Neidhart added a comment -

        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.

        Show
        Thomas Neidhart added a comment - 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.
        Thomas Neidhart made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.3.1 [ 12324073 ]
        Resolution Fixed [ 1 ]
        Thomas Neidhart made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1h 42m 1 Thomas Neidhart 22/Feb/13 10:42
        Resolved Resolved Closed Closed
        10d 8h 18m 1 Thomas Neidhart 04/Mar/13 19:00

          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