ColdFusion 10.0  -  Bug 3231157

Created on Friday, July 6, 2012

Login for more options

Title

isValid("email") is poorly implemented, in that it rejects a bunch of stuff that's legit

Description

Problem Description:
isValid("email") is poorly implemented, in that it rejects a bunch of stuff that's legit.

Steps to Reproduce:
<cfscript>
a = ["adam!caron@gmail.com", "adam##caron@gmail.com", "adam$caron@gmail.com", "adam%caron@gmail.com", "adam&caron@gmail.com", "adam'caron@gmail.com", "adam*caron@gmail.com", "adam+caron@gmail.com", "adam-caron@gmail.com", "adam/caron@gmail.com", "adam=caron@gmail.com", "adam?caron@gmail.com", "adam^caron@gmail.com", "adam_caron@gmail.com", "adam`caron@gmail.com", "adam{caron@gmail.com", "adam|caron@gmail.com", "adam}caron@gmail.com", "adam~caron@gmail.com"];
for (s in a){
writeOutput("#s#: #isValid('email', s)#<br />");
}
</cfscript>

Actual Result:
adam!caron@gmail.com: NO
adam#caron@gmail.com: NO
adam$caron@gmail.com: NO
adam%caron@gmail.com: NO
adam&caron@gmail.com: NO
adam'caron@gmail.com: YES
adam*caron@gmail.com: NO
adam+caron@gmail.com: YES
adam-caron@gmail.com: YES
adam/caron@gmail.com: NO
adam=caron@gmail.com: NO
adam?caron@gmail.com: NO
adam^caron@gmail.com: NO
adam_caron@gmail.com: YES
adam`caron@gmail.com: NO
adam{caron@gmail.com: NO
adam|caron@gmail.com: NO
adam}caron@gmail.com: NO
adam~caron@gmail.com: YES

Expected Result:
ALL should be "YES" as they're all valid email addresses.

Any Workarounds:
Don't care: we shouldn't be working around it, it should work.

Test Configuration

App Language(s) English
OS Language(s) English
Platform(s) Windows 7
Browser(s)

Notes (10)

  • Aaron Neff

    1:35:21 AM GMT+00:00 Feb 28, 2014

    Hi Adam,

    FWIW, I also confirmed that your example returns * "YES" in Splendor Public Beta.

    Thanks,
    -Aaron

  • Aaron Neff

    1:31:58 AM GMT+00:00 Feb 28, 2014

    Hi Tom,

    I just confirmed that Splendor Public Beta still returns "NO" for this:

    isValid("email", "username@domain.рф")

    Thanks,
    -Aaron

  • Tom Chiverton

    7:23:51 AM GMT+00:00 Oct 9, 2013

    Echo Adam's congrats to Anuj. Did you try with IDN domains as well e.g. username@domain.рф ?

  • Adam Cameron

    7:18:42 AM GMT+00:00 Oct 9, 2013

    VERY GOOD WORK, based on Anuj's comment below.

    Cheers.

    --
    Adam

  • Anuj Nawani

    7:10:43 AM GMT+00:00 Oct 9, 2013

    Fixed: Here are some more email ID's tested with their result using isValid() :

    "()<>[]:,;@\\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org: YES
    " "@example.org: YES
    admin@mailserver1: YES
    user@[IPv6:2001:db8:1ff::a0b:dbd0]: YES
    "very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com: YES
    "very.unusual.@.unusual.com"@example.com: YES
    disposable.style.email.with+symbol@example.com: YES
    Abc.example.com: NO
    A@b@c@example.com: NO
    a"b(c)d,e:f;gi[j\k]l@example.com: NO
    just"not"right@example.com: NO
    this is"not\allowed@example.com: NO
    this\ still\"not\\allowed@example.com: NO

  • James Moberg

    12:24:47 PM GMT+00:00 Aug 6, 2012

    I just realized that there is also a java version available. In addition to regex parsing, it can perform an optional DNS check to ensure that the domain is valid and/or connect via SMTP. (Maybe this type of verification will also cut down on spam from obviously fake domains.)
    http://code.google.com/p/isemail/downloads/detail?name=is_email_java.zip

  • James Moberg

    12:13:14 PM GMT+00:00 Aug 6, 2012

    Here's a PHP script that validates email addresses & has a lot of sample email addresses are valid that fail when validated using isValid(). Any chance that these valid email address will work with ColdFusion & CFMail? (I haven't tested them.)
    http://isemail.info/about

  • Aaron Neff

    10:29:16 AM GMT+00:00 Jul 6, 2012

    Copying over the votes from 83327:

    -----------
    Vote From Adam Cameron on Thu Jun 10 2010

    +1. There's no point offering the functionality if it doesn't work. as soon as the email addresses get a bit "tricky". -- Adam

    Vote From Henry Ho on Sat Jun 12 2010

    Vote From Julian Halliwell on Mon Jun 20 2011

    IDN validation also fails with the CFMAIL tag to/from attributes More detail and a workaround using Java is available at: http://stackoverflow.com/questions/6356460
    Vote From Aaron Neff on Sun Jun 13 2010

    +1, isValid should not return false for validly formatted email addresses
    -----------

    Since Tom Chiverton took care of logging 83327, his vote is implied.

  • Aaron Neff

    10:26:56 AM GMT+00:00 Jul 6, 2012

    Related thread: https://prerelease.adobe.com/r/?8c1ce8de4fef49eabe15ca93b69a6b9e

    Copying over the description from 83327:

    -----------
    isValid email fails on twitter, IDN domainsA twitter email with the format of :"twitter-confirmation-twitter=fusionhority.com@postmaster.twitter.com"will fail due to the = sign in the email. adam!caron@gmail.com: NO adam#caron@gmail.com: NO adam$caron@gmail.com: NO adam%caron@gmail.com: NO adam&caron@gmail.com: NO adam’caron@gmail.com: YES adam*caron@gmail.com: NO adam+caron@gmail.com: YES adam-caron@gmail.com: YES adam/caron@gmail.com: NO adam=caron@gmail.com: NO adam?caron@gmail.com: NO adam^caron@gmail.com: NO adam_caron@gmail.com: YES adam`caron@gmail.com: NO adam{caron@gmail.com: NO adam|caron@gmail.com: NO adam}caron@gmail.com: NO adam~caron@gmail.com: YESAll of those should be "YES"."Adam Bhjkasd"@gmail.com which is completely valid, but - somewhat predictably - it also failed.I tried an IDN domain name such astest@test.[stupid bug tracker wont letter me past the russian IDN here. It's like a p then an o with a vertical line through]and that comes back NO though obviously it should be fine.
    -----------

  • Adam Cameron

    1:58:13 AM GMT+00:00 Jul 6, 2012

    BTW, this is to replace the initial bug that was logged on my behalf, which was 83327 (http://www.elliottsprehn.com/cfbugs/bugs/83327), which you didn't migrate to the new system.

Duplicate ID
Reported By Adam Cameron

Status

State Closed
Status Fixed
Reason

Importance

Priority 1-Low
Frequency Some users will encounter
Failure Type Enhancement Request
Product Area Language

Build

Found In Build 9.0.1
Fixed In Build 286391

Attachments (0)

No Files Attached

Votes (3)

  • Tom Chiverton

    7:42:40 AM GMT+00:00 Sep 3, 2012

    My vote from the prerelease appears to have been dropped. Not supporting IDN is fail. Not using the underlying Java code that actually works is fail. Not doing this for years is fail.

  • Dave DuPlantis

    10:32:43 AM GMT+00:00 Jul 18, 2012

    There's no point in having built-in email validation unless it's complex; we can already write a basic regex to do incomplete validation. The point of having named validation should be to provide the accurate and complete validation when we need it.

  • Aaron Neff

    10:21:21 AM GMT+00:00 Jul 6, 2012

    +1. Incorrect results shouldn't be supported. Isn't fair to request tickets to be raised, and then not migrate them to the new tracker. It was a public ticket, so it should've been migrated.

Your session has expired! Click to login
Current form data will be preserved

Cancel