• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfmail fails on address with leading dot

New Here ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

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

Views

514

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 07, 2019 May 07, 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 unle
...

Votes

Translate

Translate
LEGEND ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 11, 2019 May 11, 2019

Copy link to clipboard

Copied

LATEST

While valid, do any other system choke when dots are used like this?  UTF-8 characters in an email address were valid and supported by gmail... until they weren't.  I couldn't get a UTF-8 addresses to validate or send using ColdFusion.  (At one point, ColdFusion didn't like valid Microsoft OneDrive URLs either.)   Even if determined valid by ColdFusion, you may need to reject it if other systems that you exchange the data with won't accept it as valid.

I filed a recent bug where username + email address combination are being evaluated as a valid email address. No other library validates "Testy McTest" <test@teset.com> as valid email address.  A result of this mistake (and other bugs in the past), I've used my own isEmail() UDF so I can add my own exceptions to the rule as needed. (I also incorporated an isEmail() java library with optional DNS/MX record checking and rejection of temporary/test email addresses that aren't sendable by users.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation