Properly encode outgoing UTF-8 email address

Description

Email sent using cfmail tag to an email address using UTF-8 characters (i.e. ëmâil@somecompany.com) is bounced by Spam detection due to "malformed header".

The address should be UTF-8 encoded, especially if cfmail charset="utf-8" is used.
Email address in TO HEADER should contain =?utf-8? prefix, like so:

Properties props = new Properties(); props.put("mail.mime.allowutf8", true); Session session = Session.getInstance(props);

https://javaee.github.io/javamail/docs/api/javax/mail/internet/package-summary.html

Attachments

1
  • 27 Jan 2022, 01:31 pm

Activity

Show:

Tim Smolders 31 March 2023 at 07:40

thank you for picking this up! Sorry I couldn’t be of more help.

Zac Spitzer 30 March 2023 at 15:02

test case updated, needed a <cfmail async=false> otherwise the pop3 fetch doesn’t see the mail, as it’s waiting in the spooler!

as this ends up spitting out lots of console warnings, depending on the remote mail server, this property doesn’t seem like an option

at the moment, I am setting that variable when charset is utf-8 which is the default

maybe the option is to use the new api methods, but I’m not sure

https://jcp.org/aboutJava/communityprocess/maintenance/jsr919/JavaMail-1.6-changes.txt

the PR has a test case in place, which doesn’t work with greenmail

Zac Spitzer 30 March 2023 at 11:22

alas, SMTPUTF8 is not yet supported by greenmail

https://github.com/greenmail-mail-test/greenmail/issues/535

Zac Spitzer 30 March 2023 at 11:16

https://github.com/lucee/Lucee/pull/1993

getting the following back from greenmail (which is what we use for smtp testing in CI)

[INFO] [java] [script] test.tickets.LDEV3846 (1 tests passed in 13 ms) [INFO] [java] [script] Mär 30, 2023 11:11:52 AM javax.mail.Session loadResource [INFO] [java] [script] WARNUNG: expected resource not found: /META-INF/javamail.default.address.map [INFO] [java] [script] Mär 30, 2023 11:11:52 AM javax.mail.Session loadResource [INFO] [java] [script] WARNUNG: expected resource not found: /META-INF/javamail.default.address.map [INFO] [java] [script] Mär 30, 2023 11:11:52 AM com.sun.mail.smtp.SMTPTransport protocolConnect [INFO] [java] [script] INFORMATION: mail.mime.allowutf8 set but server doesn't advertise SMTPUTF8 support [INFO] [java] [script] Mär 30, 2023 11:11:52 AM com.sun.mail.smtp.SMTPTransport protocolConnect [INFO] [java] [script] INFORMATION: mail.mime.allowutf8 set but server doesn't advertise SMTPUTF8 support

I need extend the test case to check the headers are being set properly

Tim Smolders 30 March 2023 at 06:48

Issue persists. Lucee should be able to send email to valid email addresses.

Details

Assignee

Reporter

Labels

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Priority

Created 27 January 2022 at 13:31
Updated 12 November 2024 at 10:52

Flag notifications