Uploaded image for project: 'Commons Email'
  1. Commons Email
  2. EMAIL-80

Message incorrectly displayed on outlook and Outlook Web access

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.1
    • 1.2
    • None

    Description

      Hello.

      I try to write HTML Email with version 1.1 and 1.0.
      With version 1.1, I found that the email was not correctly display when there is no image embed into the mail content. Outlook web access only display the text message and the HTML content is attached as an attachment.
      But, when there is at least one image, the message is corerctly displayed.

      This does not happends with version 1.0.

      Here is the source code used:

      HtmlEmail email = new HtmlEmail();
      email.setHostName("192.32.16.76");
      email.setFrom("user@domain.com");
      email.addTo("user1@domain.com");

      String s_RessourceName = "support.gif";
      URL url = TestLoader.class.getResource(s_RessourceName);
      StringBuffer sb_MsgContent = new StringBuffer();
      sb_MsgContent.append("<html><body><center><b>mon message pour voir ma classe sans image</b></center>");
      sb_MsgContent.append("</body></html>");
      email.setHtmlMsg(sb_MsgContent.toString());

      email.setTextMsg("Your email client does not support HTML messages");
      email.send();

      And with image

      HtmlEmail email = new HtmlEmail();
      email.setHostName("192.32.16.76");
      email.setFrom("user@domain.com");
      email.addTo("user1@domain.com");

      String s_RessourceName = "support.gif";
      URL url = TestLoader.class.getResource(s_RessourceName);
      String s_RessourceId = email.embed(url, "Support logo");
      StringBuffer sb_MsgContent = new StringBuffer();
      sb_MsgContent.append("<html><body><center><b>mon message pour voir ma classe sans image</b></center>");
      sb_MsgContent.append("<p><img src=\"cid:").append(s_RessourceId).append("\"></p>");
      sb_MsgContent.append("</body></html>");
      email.setHtmlMsg(sb_MsgContent.toString());

      email.setTextMsg("Your email client does not support HTML messages");
      email.send();

      Regards

      Etienne Jouvin

      Attachments

        Activity

          People

            sgoeschl Siegfried Goeschl
            ejouvin Etienne Jouvin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: