bbottema / simple-java-mail

Simple API, Complex Emails (Jakarta Mail smtp wrapper)

Home Page:http://www.simplejavamail.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update JavaMail dependency to 1.6.2, adding support for UTF-8 charset

mommcilo opened this issue · comments

Address
test.töst@test.com
is not valid

MailerBuilder.clearEmailAddressCriteria()

doesn't play any role because

org.hazlewood.connor.bottema.emailaddress.EmailAddressValidator#isValidMailbox still return false

Just change email to

test.tost@test.com

it became valid. Using RFC strategy also is not working. According to the latest RFC UTF-8 is valid to be used in emails.

This issue can be closed. Here is example:

https://github.com/mommcilo/test-simple-java-mail

In version 5.1.0 with clearEmailAddressCriteria it works but I used 5.0.1 in which it doesn't work.

I was just looking at your report! clearEmailAddressCriteria had a bug in previous versions, that's indeed fixed in 5.0.6 (under #167).

Still stays a question why EmailAddressCriteria.RFC_COMPLIANT mailer doesn't accept UTF-8 when it became standard. It would be better to have validator, which accepts UTF-8 and validate a lot of other things, then to not have any. If you use example I provided you will see it only works if you use clearEmailAddressCriteria

Perhaps this similar issue sheds some light on the issue: bbottema/email-rfc2822-validator#9

com.sun.mail:javax.mail for example already changed logic according to the specification. And I will add this here in case someone have same problem. In my app this was dependency tree(javax.mail was loaded from spring-boot parent)

[INFO] +- org.simplejavamail:simple-java-mail:jar:5.1.0:compile
[INFO] |  +- com.sun.mail:javax.mail:jar:1.5.6:compile

and even if I use clearEmailAddressCriteria it want pass because this version of javax.mail will not validate positively non asci email.

And then I had to exclude javax.mail and provide explicit dependency to the latest

[INFO] +- org.simplejavamail:simple-java-mail:jar:5.1.0:compile
[INFO]   +- com.sun.mail:javax.mail:jar:1.6.2:compile

Now it works.

Will update the JavaMail dependency for the 6.0.0 release.

Updated javax.mail version for upcoming release 6.0.0.