Commons Email
  1. Commons Email
  2. EMAIL-104

The system property "mail.mime.charset" is not applied to contents.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3.2
    • Labels:

      Description

      Both of JavaMail and Commons Email encode subjects and personal names with the system property "mail.mime.charset" when no charsets are specified via methods. Also they encode attached filenames with the property when the other system property "mail.mime.encodefilename" is set (regardless of RFC). On the other hand, JavaMail encodes text contents with the property via setText methods when no charsets specified, but Commons Email doesn't encode the contents via setMsg/setTextMsg/setHtmlMsg methods. The partial difference of the behaviors makes confusion.

        Activity

        Hide
        Thomas Neidhart added a comment -

        I can not reproduce the mentioned problem with HtmlEmails and only html content. The content type is correctly set to text/html.

        Show
        Thomas Neidhart added a comment - I can not reproduce the mentioned problem with HtmlEmails and only html content. The content type is correctly set to text/html.
        Hide
        Mike Gratsas added a comment -

        Trying to send E-mail messages from the Sharp IMG Viewer web site http://sharpimg-viewer.appspot.com powered by Google AppEngine using the latest Commons Email version 1.3.3 I found an issue. I called the method mail.setHtmlMsg(html); where mail is an instance of HtmlEmail class. However, the HTML body is interpreted as plain text now since the content type was changed from EmailConstants.TEXT_HTML to EmailConstants.TEXT_SUBTYPE_HTML in version 1.3.2.

        Show
        Mike Gratsas added a comment - Trying to send E-mail messages from the Sharp IMG Viewer web site http://sharpimg-viewer.appspot.com powered by Google AppEngine using the latest Commons Email version 1.3.3 I found an issue. I called the method mail.setHtmlMsg(html); where mail is an instance of HtmlEmail class. However, the HTML body is interpreted as plain text now since the content type was changed from EmailConstants.TEXT_HTML to EmailConstants.TEXT_SUBTYPE_HTML in version 1.3.2.
        Hide
        Thomas Neidhart added a comment -

        Fixed in r1532531 by using the appropriate setText() methods in case of text content.

        The corresponding unit tests can be further improved but there seems to be a bug in junit when using non-standard charsets.

        Show
        Thomas Neidhart added a comment - Fixed in r1532531 by using the appropriate setText() methods in case of text content. The corresponding unit tests can be further improved but there seems to be a bug in junit when using non-standard charsets.
        Hide
        Thomas Neidhart added a comment -

        Could you please attach a minimal test case illustrating the problem?

        Thanks,

        Thomas

        Show
        Thomas Neidhart added a comment - Could you please attach a minimal test case illustrating the problem? Thanks, Thomas
        Hide
        Hiroshi Ikeda added a comment -

        I forget many things about several months ago, and I find my memo which says:
        If you call MimeMessage/MimeBody.setContent directly, instead of setText, then the system property "mail.mime.charset" is not used. HtmlEmail and SimpleEmail in Commons Email call the setContent methods.

        Show
        Hiroshi Ikeda added a comment - I forget many things about several months ago, and I find my memo which says: If you call MimeMessage/MimeBody.setContent directly, instead of setText, then the system property "mail.mime.charset" is not used. HtmlEmail and SimpleEmail in Commons Email call the setContent methods.
        Hide
        Siegfried Goeschl added a comment -

        Well - I need to read up on the Mail API ...

        Show
        Siegfried Goeschl added a comment - Well - I need to read up on the Mail API ...
        Hide
        Siegfried Goeschl added a comment -

        I'm not sure if I understand the problem correctly

        +) setTextMsg() and setHtmlMsg() take the plain string
        +) that plain strings are afterwards encoded when the MimeMessage is built (HTMLEmail.build())

        Can you please clarify?

        Show
        Siegfried Goeschl added a comment - I'm not sure if I understand the problem correctly +) setTextMsg() and setHtmlMsg() take the plain string +) that plain strings are afterwards encoded when the MimeMessage is built (HTMLEmail.build()) Can you please clarify?

          People

          • Assignee:
            Unassigned
            Reporter:
            Hiroshi Ikeda
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development