Skip to main content
Participant
May 7, 2019
Answered

cfmail fails on address with leading dot

  • May 7, 2019
  • 1 reply
  • 771 views

Since loading Update 10 for Cold Fusion 2016, cfmail fails when sending email to an address with a leading dot. When using the address ".johnsmith(at)yahoo.com", the IsValid() function returns true, but cfmail fails with the error "Empty label is not a legal name". Prior to loading the update, emails to this customer were sent successfully.

This appears to be related to IDN.toASCII:

java.lang.IllegalArgumentException: Empty label is not a legal name

     at java.net.IDN.toASCIIInternal(Unknown Source)

     at java.net.IDN.toASCII(Unknown Source)

     at java.net.IDN.toASCII(Unknown Source)

     at coldfusion.mail.MailImpl._toIDNEmail(MailImpl.java:578)

     at coldfusion.mail.MailImpl.toIDNEmail(MailImpl.java:566)

     at coldfusion.mail.MailImpl.setInternetAddress(MailImpl.java:541)

     at coldfusion.tagext.net.MailTag.validate(MailTag.java:737)

     at coldfusion.tagext.net.MailTag.processAttributes(MailTag.java:846)

I found a openJDK bug report on this issue, but it was closed as "not an issue".

     [JDK-8081570] IDN.toASCII failing on leading dots - Java Bug System

Has anyone else experienced this problem? If so, is there a work-around?

Thanks,

Neil

This topic has been closed for replies.
Correct answer WolfShade

Regardless of whether or not it worked prior to the u10, according to Wikipedia a dot is allowed in the local-part (before the @) if it is not the first or last character in the local-part, the exception being if the dot is surrounded by double-quotes.

The local-part of the email address may use any of these ASCII characters:

  • uppercase and lowercase Latin letters A to Z and a to z;
  • digits 0 to 9;
  • printable characters !#$%&'*+-/=?^_`{|}~;
  • dot ., provided that it is not the first or last character unless quoted, and provided also that it does not appear consecutively unless quoted (e.g. John..Doe@example.com is not allowed but "John..Doe"@example.com is allowed);[8]

V/r,

^ _ ^

UPDATE:  I guess what I'm saying is:  You could check the first character of the email address, and the last part before the @; if there isn't a dot, send normally; if there IS a dot, surround the local-part with double quotes, and this _might_ be a valid workaround. 

1 reply

WolfShade
WolfShadeCorrect answer
Legend
May 7, 2019

Regardless of whether or not it worked prior to the u10, according to Wikipedia a dot is allowed in the local-part (before the @) if it is not the first or last character in the local-part, the exception being if the dot is surrounded by double-quotes.

The local-part of the email address may use any of these ASCII characters:

  • uppercase and lowercase Latin letters A to Z and a to z;
  • digits 0 to 9;
  • printable characters !#$%&'*+-/=?^_`{|}~;
  • dot ., provided that it is not the first or last character unless quoted, and provided also that it does not appear consecutively unless quoted (e.g. John..Doe@example.com is not allowed but "John..Doe"@example.com is allowed);[8]

V/r,

^ _ ^

UPDATE:  I guess what I'm saying is:  You could check the first character of the email address, and the last part before the @; if there isn't a dot, send normally; if there IS a dot, surround the local-part with double quotes, and this _might_ be a valid workaround. 

Participant
May 7, 2019

In my initial testing, this seems like a valid work-around. At least cfmail doesn't choke on the address anymore. Thanks!

WolfShade
Legend
May 7, 2019

You're welcome.  Glad the workaround is successful.

I just thought of something else.  The article also indicated that if there are two or more consecutive dots (as per the example) that the local-part would also have to be within double-quotes.  So, you should also add a RegEx check for that.

V/r,

^ _ ^

PS.  Thank you for marking my answer as correct.  I do appreciate it, and I'm sure anyone else with the same issue will appreciate it, too.