cfmail crashes on email addresses with trailing commas

Description

https://dev.lucee.org/t/attribute-cc-of-the-tag-mail-is-invalid/8769/5

Attribute [to] of the tag [mail] is invalidDetail[] cannot be converted to an email addressStacktraceThe Error Occurred in
C:\lucee\tomcat\webapps\ROOT\cfmail.cfm: line 1
1: <Cfmail from="zak.spitza@gmail.com" to="zak.spitza@gmail.com," subject="test">
2: boom
3: </Cfmail>
Caused by: lucee.runtime.net.mail.MailException: [] cannot be converted to an email address
at lucee.runtime.net.mail.MailUtil.parseEmail(MailUtil.java:185)
at lucee.runtime.net.mail.MailUtil.fromList(MailUtil.java:128)
at lucee.runtime.net.mail.MailUtil.toInternetAddresses(MailUtil.java:70)
at lucee.runtime.net.smtp.SMTPClient.addTo(SMTPClient.java:270)
at lucee.runtime.tag.Mail.setTo(Mail.java:209)
... 40 more

just needs a length check here?

https://github.com/lucee/Lucee/blob/5.3/core/src/main/java/lucee/runtime/net/mail/MailUtil.java#L128

Environment

None

Activity

Pothys - MitrahSoft 27 August 2021 at 14:49

Pothys - MitrahSoft 25 August 2021 at 11:27

The above fix solves your issue also and works fine like before. And I added a testcase for this ticket.

Matt Jones 24 August 2021 at 14:55

asked that i include this:

we had similar messages 'Attribute [from] of the tag [mail] is invalid' in breaks where we had commas in the display name of from address, causing a full break. previously these didn't break completely. not looking for any change, just want to share observation.

appears to be working correctly for us in all versions
emails like:
"blah, inc" <noreply@blah.com>

some occurrances someone had changed to appending together vars together, which dropped the quotes wrapping the display name portion, resulting in emails like:
"blah, inc <noreply@blah.com>"

we fixed our code, and weren't going to complain about it, because we considered the missing quotes wrong, but it definitely was a behavior change.

up through 5.3.7.47
would send an email as if the from was:
inc <noreply@blah.com>

after 5.3.7.47
full break, no email sent

Pothys - MitrahSoft 24 August 2021 at 14:40

This commit cause this issue I've added a fix for this ticket.

Pull Request:

Fixed

Assignee

Reporter

Priority

Fix versions

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

Sprint

Affects versions

Created 23 August 2021 at 16:13
Updated 4 February 2025 at 11:31
Resolved 30 August 2021 at 09:08