Hi Aleksandr!

What is your Wildfly version?

Wildfly 8 has buggy Java Mail API. In Wildfly 9 and later proper encoding is done automatically, no need to `encodeText` manually.

See my answer here: http://stackoverflow.com/questions/35010796/wildfly-9-x-fails-encoding-greek-attachment-filenames

-- 
Tair Sabirgaliev


On 7 June 2016 at 11:03:50, keycloak-user-request@lists.jboss.org (keycloak-user-request@lists.jboss.org) wrote:

Message: 1
Date: Mon, 6 Jun 2016 12:12:26 +0000
From: Nekrasov Aleksandr <a.nekrasov@ftc.ru>
Subject: [keycloak-user] Email internationalization
To: "keycloak-user@lists.jboss.org" <keycloak-user@lists.jboss.org>
Message-ID: <59219ba4c1b449d0a2bded5436b8ca6a@nut-mbx-4.win.ftc.ru>
Content-Type: text/plain; charset="koi8-r"

Hello everyone.
I found a bug when trying to send email from keycloak to users with encoding against English.
For example, when I try to send Russian message with subject "???????? ???? ??????? ??????" I see "????????????? ?????? ??????????? ?????" in my email.

I think you should update org.keycloak.email.DefaultEmailSenderProvider class with line
msg.setSubject(subject);
to
msg.setSubject(MimeUtility.encodeText(subject, "utf-8", "B"));

Thanks.

Nekrasov Aleksander,
Developer,
Center of Financial Techologies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160606/bea2f782/attachment-0001.html

------------------------------

Message: 2
Date: Mon, 6 Jun 2016 19:38:59 +0200
From: Stian Thorgersen <sthorger@redhat.com>
Subject: Re: [keycloak-user] Email internationalization
To: Nekrasov Aleksandr <a.nekrasov@ftc.ru>
Cc: "keycloak-user@lists.jboss.org" <keycloak-user@lists.jboss.org>
Message-ID:
<CAJgngAeDFzb96dtFGgz59_RE-A3oGAJUNsNFPA-xXjxvYWipGw@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Please create a JIRA. If you want to submit a PR that would be welcome as
well.

On 6 June 2016 at 14:12, Nekrasov Aleksandr <a.nekrasov@ftc.ru> wrote:

> Hello everyone.
>
> I found a bug when trying to send email from keycloak to users with
> encoding against English.
>
> For example, when I try to send Russian message with subject ?????????
> ???? ??????? ??????? I see ?????????????? ?????? ??????????? ?????? in my
> email.
>
>
>
> I think you should update org.keycloak.email.DefaultEmailSenderProvider
> class with line
>
> msg.setSubject(subject);
>
> to
>
> msg.setSubject(MimeUtility.*encodeText*(subject, *"utf-8"*, *"B"*));
>
>
>
> Thanks.
>
>
>
> Nekrasov Aleksander,
>
> Developer,
>
> Center of Financial Techologies
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160606/21c2041b/attachment-0001.html

------------------------------