Commons Email
  1. Commons Email
  2. EMAIL-101

Specified Content-ID is not used when embedding a File object in an HtmlEmail

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0, 1.1, 1.2
    • Fix Version/s: 1.3
    • Labels:
      None

      Description

      When calling the .embed(File file, String cid) method on HtmlEmail, the cid argument is never used within the method.

      Consequently, even when the user specifies a Content-ID for the embedded File, a new randomly generated Content-ID is generated every time.

      I believe this is as simple as changing the last line of .embed(File file, String cid) from:

      return embed(new FileDataSource(file), file.getName());

      To:

      return embed(new FileDataSource(file), file.getName(), cid);

      1. EMAIL-101_encoding.patch
        1 kB
        Thomas Neidhart
      2. EMAIL-101.patch
        4 kB
        Siegfried Goeschl
      3. HtmlEmail.patch
        0.1 kB
        Andrew Starodub
      4. HtmlEmailTest.patch
        1 kB
        Andrew Starodub

        Activity

        Hide
        Andrew Starodub added a comment -

        Attaching patch file to correct return line in HtmlEmail.embed(File file, String cid)

        Show
        Andrew Starodub added a comment - Attaching patch file to correct return line in HtmlEmail.embed(File file, String cid)
        Hide
        Andrew Starodub added a comment -

        Attaching a patch that includes a regression test for making sure the returned CID is the same as the user-specified CID.

        Show
        Andrew Starodub added a comment - Attaching a patch that includes a regression test for making sure the returned CID is the same as the user-specified CID.
        Hide
        Siegfried Goeschl added a comment -

        Hi Andrew, thanks for the patch ...

        Show
        Siegfried Goeschl added a comment - Hi Andrew, thanks for the patch ...
        Hide
        Siegfried Goeschl added a comment -

        This innocent change breaks actually the EmailLiveTests ... ... reopening to investigate the problem

        Show
        Siegfried Goeschl added a comment - This innocent change breaks actually the EmailLiveTests ... ... reopening to investigate the problem
        Hide
        Siegfried Goeschl added a comment -

        Updated patch (hackergarden vienna)

        Show
        Siegfried Goeschl added a comment - Updated patch (hackergarden vienna)
        Hide
        Thomas Neidhart added a comment -

        Added an updated patch for the broken inline images. The cid has to be encoded properly (see http://tools.ietf.org/html/rfc2392).

        Show
        Thomas Neidhart added a comment - Added an updated patch for the broken inline images. The cid has to be encoded properly (see http://tools.ietf.org/html/rfc2392 ).
        Hide
        Thomas Neidhart added a comment -

        Resolved in r1418897:

        • added a EmailUtils.encodeUrl method (based on commons-codec)
          to url encode an input string according to rfc 2392
        • use the provided cid instead of generating a random one
        • update unit-tests & javadoc, as the returned cid will be url encoded
        Show
        Thomas Neidhart added a comment - Resolved in r1418897: added a EmailUtils.encodeUrl method (based on commons-codec) to url encode an input string according to rfc 2392 use the provided cid instead of generating a random one update unit-tests & javadoc, as the returned cid will be url encoded

          People

          • Assignee:
            Siegfried Goeschl
            Reporter:
            Andrew Starodub
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development