Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with mail headers ("from", "to") and umlauts (OK in "subject")

    Hi Isomorphic,

    I have a question regarding mail headers (from, subject) and umlauts.

    To me it seems there is some difference in how you set those.
    This is my mail configuration in .ds.xml:

    Code:
            <operationBinding operationType="fetch" operationId="writeMailLeadMovedToPicklist" serverMethod="writeMailLeadMovedToPicklist">
                <mail contentType="text/html">
                    <from>$customerSettings.customerMailFrom</from>
                    <to>$CASEWORKER_EMAILENTRY_USE</to>
                    <bcc>$customerSettings.customerMailBCC</bcc>
                    <subject>$t_translation.getTranslation($CASEWORKER_LANG_ISO_639_1_AL_2, "mail_leadMovedToPicklistTemplateReseller", "subject")</subject>
                    <templateFile>mails/leadMovedToPicklistTemplateReseller.html</templateFile>
                </mail>
            </operationBinding>
    It results in such an email header (some fields redacted):
    Code:
    Return-Path: <xxx@yyy.net>
    Delivered-To: xxx@yyy.net
    Received: from server.net
        by server.net with LMTP
        id ABCDEFGHIJKLM
        (envelope-from <xxx@yyy.net>)
        for <xxx@yyy.net>; Thu, 16 May 2019 10:45:20 +0200
    Return-path: <xxx@yyy.net>
    Envelope-to: xxx@yyy.net
    Delivery-date: Thu, 16 May 2019 10:45:20 +0200
    Received: from server.net ([1.2.3.4]:44330 helo=mytomcat)
        by server.net with esmtpsa (TLSv1:ECDHE-RSA-AES256-SHA:256)
        (Exim 4.91)
        (envelope-from <xxx@yyy.net>)
        id 1hRC0u-001Wm0-8o; Thu, 16 May 2019 10:45:20 +0200
    Date: Thu, 16 May 2019 10:45:21 +0200 (CEST)
    [B]From: "original text with just umlauts removed" <xxx@yyy.net>[/B]
    [B]To: Givenname Surname <email@server.de>[/B]
    Message-ID: <478510790.490.1557996321528.JavaMail.tomcat@mytomcat>
    [B]Subject: =?Cp1252?Q?Ein_neues_Lead_ist_f=FCr_Sie_verf=FCgbar?=[/B]
    MIME-Version: 1.0
    Content-Type: text/html; charset=UTF-8
    Content-Transfer-Encoding: quoted-printable
    As you can see, some encoding information is set to the Subject. This does not happen to From and To.

    Subjects are then displayed just fine in email programs, in to and from all umlauts are just removed - not there.
    For to I do some replacement before. A user "Max Müller" <max.mueller@test.de> does not care if his name is written as "Max Mueller" <max.mueller@test.de> in general.
    This is not true for from where there is normally a company name contained that should preserve the umlauts in a name.
    I know that there is a javax setSubject() overload that is taking an encoding parameter and that there is no such thing for e.g. setFrom(), setsetRecipients(), but there must be some way to send umlauts here, I just can't find out how. Perhaps you can help as you either know this or can deduce it from the methods you are using when creating a mail.

    In my .ds.xml, the velocity variables hold content fetched from the DB as normal type="text" field.
    The text "original text with just umlauts removed" <xxx@yyy.net> from above in reality is "original text with just umlautsäöü removed" <xxx@yyy.net>

    Best regards
    Blama

    #2
    Hi Isomorphic,

    we are using version 1.4.2 of mail.jar you are shipping, which seems to be from February 2009. Current version is 1.6.2 from August 2018.
    It does contain changes for umlauts in mail-addresses, which most likely is not a common thing in the US, very seldom just in Germany, but might be used a lot in non-western countries.
    It does require JDK 1.7, which is not a problem for me, but perhaps for you. But I'd assume that it is safe nowadays to require Java 8 for projects in active development.

    This does not directly relate to the umlaut-in-from/to, but also to umlauts in general.

    Best regards
    Blama

    Comment


      #3
      It sounds like you are suggesting that the problem may be corrected by a newer version of mail.jar. You didn't say whether this new mail.jar version is backwards compatible or whether you've tried it - please let us know.

      Comment


        #4
        Hi Isomorphic,

        will do, but the general question was "How do you set From/To for a mail in your servercode for a <mail>-tag" and if you know this problem from your own projects.

        Best regards
        Blama

        Comment


          #5
          Hi Isomorphic,

          just replacing your mail.jar with javax.mail.jar v1.6.2 from https://javaee.github.io/javamail/#D...vaMail_Release fixes the problem for me:
          Click image for larger version

Name:	Mail-Umlauts.png
Views:	114
Size:	5.8 KB
ID:	257806

          Best regards
          Blama

          Comment


            #6
            Hi Isomorphic,

            the "missing" Umlauts is probably some rendering problem. In other views in different mail programs the umlauts are displayed as broken:

            Roundcube bad:
            Click image for larger version

Name:	Mail-Umlauts2.png
Views:	107
Size:	2.6 KB
ID:	257808

            Office365 bad:
            Click image for larger version

Name:	Mail-Umlauts3.png
Views:	108
Size:	8.0 KB
ID:	257809

            With the new version, both look good:

            Roundcube good:
            Click image for larger version

Name:	Mail-Umlauts4.png
Views:	106
Size:	2.4 KB
ID:	257811


            Office365 good:
            Click image for larger version

Name:	Mail-Umlauts5.png
Views:	95
Size:	3.1 KB
ID:	257810


            Best regards
            Blama

            Comment


              #7
              We actually do already ship 12.1 (still in development as of this post) with version 1.6.2. For those on past releases, if you're having this issue, please replace activation.jar and mail.jar with the suggested jar to resolve this problem if you're encountering it.

              Comment


                #8
                Hi Isomorphic,

                just to let you know, there is now a version 1.6.4 available on the EE4J page as well.

                Best regards
                Blama

                Comment

                Working...
                X