Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
Ben Nadel at CFUNITED 2010 (Landsdown, VA) with: Elliott Sprehn and Debbie Flax
Ben Nadel at CFUNITED 2010 (Landsdown, VA) with: Elliott Sprehn@ElliottZ ) and Debbie Flax

ColdFusion 11 Accepts All Top-Level Domains (TLD) For IsValid() Email Validation

By Ben Nadel on
Tags: ColdFusion

The other day, one of my users was having trouble changing his email address because he was using the ".marketing" top-level domain (TLD). In production, we still run ColdFusion 9, which has historically had problems with isValid( "email" ). I know I'm a bit behind in the ColdFusion times, so I wanted to see if recent ColdFusion releases have made any progress in this area.

To test, I got the list of top-level domains from ICANN. Then, I simply looped over each one to see if isValid() would accept it or reject it:

  • <cfscript>
  •  
  • // Get a list of all the top-level domains (TLD) as outlined by the Icann.org:
  • // https://www.icann.org/resources/pages/tlds-2012-02-25-en
  • topLevelDomains = "ABOGADO AC ACADEMY ACCOUNTANTS ACTIVE ACTOR AD ADULT AE AERO AF AG AGENCY AI AIRFORCE AL ALLFINANZ ALSACE AM AMSTERDAM AN ANDROID AO AQ AQUARELLE AR ARCHI ARMY ARPA AS ASIA ASSOCIATES AT ATTORNEY AU AUCTION AUDIO AUTOS AW AX AXA AZ BA BAND BANK BAR BARGAINS BAYERN BB BD BE BEER BERLIN BEST BF BG BH BI BID BIKE BIO BIZ BJ BLACK BLACKFRIDAY BLOOMBERG BLUE BM BMW BN BNPPARIBAS BO BOO BOUTIQUE BR BRUSSELS BS BT BUDAPEST BUILD BUILDERS BUSINESS BUZZ BV BW BY BZ BZH CA CAB CAL CAMERA CAMP CANCERRESEARCH CAPETOWN CAPITAL CARAVAN CARDS CARE CAREER CAREERS CARTIER CASA CASH CAT CATERING CC CD CENTER CEO CERN CF CG CH CHANNEL CHEAP CHRISTMAS CHROME CHURCH CI CITIC CITY CK CL CLAIMS CLEANING CLICK CLINIC CLOTHING CLUB CM CN CO COACH CODES COFFEE COLLEGE COLOGNE COM COMMUNITY COMPANY COMPUTER CONDOS CONSTRUCTION CONSULTING CONTRACTORS COOKING COOL COOP COUNTRY CR CREDIT CREDITCARD CRICKET CRS CRUISES CU CUISINELLA CV CW CX CY CYMRU CZ DAD DANCE DATING DAY DE DEALS DEGREE DELIVERY DEMOCRAT DENTAL DENTIST DESI DEV DIAMONDS DIET DIGITAL DIRECT DIRECTORY DISCOUNT DJ DK DM DNP DO DOCS DOMAINS DOOSAN DURBAN DVAG DZ EAT EC EDU EDUCATION EE EG EMAIL EMERCK ENERGY ENGINEER ENGINEERING ENTERPRISES EQUIPMENT ER ES ESQ ESTATE ET EU EUROVISION EUS EVENTS EVERBANK EXCHANGE EXPERT EXPOSED FAIL FARM FASHION FEEDBACK FI FINANCE FINANCIAL FIRMDALE FISH FISHING FIT FITNESS FJ FK FLIGHTS FLORIST FLOWERS FLSMIDTH FLY FM FO FOO FORSALE FOUNDATION FR FRL FROGANS FUND FURNITURE FUTBOL GA GAL GALLERY GARDEN GB GBIZ GD GE GENT GF GG GGEE GH GI GIFT GIFTS GIVES GL GLASS GLE GLOBAL GLOBO GM GMAIL GMO GMX GN GOOGLE GOP GOV GP GQ GR GRAPHICS GRATIS GREEN GRIPE GS GT GU GUIDE GUITARS GURU GW GY HAMBURG HAUS HEALTHCARE HELP HERE HIPHOP HIV HK HM HN HOLDINGS HOLIDAY HOMES HORSE HOST HOSTING HOUSE HOW HR HT HU IBM ID IE IL IM IMMO IMMOBILIEN IN INDUSTRIES INFO ING INK INSTITUTE INSURE INT INTERNATIONAL INVESTMENTS IO IQ IR IRISH IS IT IWC JE JETZT JM JO JOBS JOBURG JP JUEGOS KAUFEN KDDI KE KG KH KI KIM KITCHEN KIWI KM KN KOELN KP KR KRD KRED KW KY KZ LA LACAIXA LAND LAT LATROBE LAWYER LB LC LDS LEASE LEGAL LGBT LI LIDL LIFE LIGHTING LIMITED LIMO LINK LK LOANS LONDON LOTTE LOTTO LR LS LT LTDA LU LUXE LUXURY LV LY MA MADRID MAISON MANAGEMENT MANGO MARKET MARKETING MARRIOTT MC MD ME MEDIA MEET MELBOURNE MEME MEMORIAL MENU MG MH MIAMI MIL MINI MK ML MM MN MO MOBI MODA MOE MONASH MONEY MORMON MORTGAGE MOSCOW MOTORCYCLES MOV MP MQ MR MS MT MU MUSEUM MV MW MX MY MZ NA NAGOYA NAME NAVY NC NE NET NETWORK NEUSTAR NEW NEXUS NF NG NGO NHK NI NINJA NL NO NP NR NRA NRW NU NYC NZ OKINAWA OM ONG ONL OOO ORG ORGANIC OSAKA OTSUKA OVH PA PARIS PARTNERS PARTS PARTY PE PF PG PH PHARMACY PHOTO PHOTOGRAPHY PHOTOS PHYSIO PICS PICTURES PINK PIZZA PK PL PLACE PLUMBING PM PN POHL POKER PORN POST PR PRAXI PRESS PRO PROD PRODUCTIONS PROF PROPERTIES PROPERTY PS PT PUB PW PY QA QPON QUEBEC RE REALTOR RECIPES RED REHAB REISE REISEN REIT REN RENTALS REPAIR REPORT REPUBLICAN REST RESTAURANT REVIEWS RICH RIO RIP RO ROCKS RODEO RS RSVP RU RUHR RW RYUKYU SA SAARLAND SALE SAMSUNG SARL SB SC SCA SCB SCHMIDT SCHULE SCHWARZ SCIENCE SCOT SD SE SERVICES SEW SEXY SG SH SHIKSHA SHOES SHRIRAM SI SINGLES SJ SK SKY SL SM SN SO SOCIAL SOFTWARE SOHU SOLAR SOLUTIONS SOY SPACE SPIEGEL SR ST SU SUPPLIES SUPPLY SUPPORT SURF SURGERY SUZUKI SV SX SY SYDNEY SYSTEMS SZ TAIPEI TATAR TATTOO TAX TC TD TECHNOLOGY TEL TF TG TH TIENDA TIPS TIRES TIROL TJ TK TL TM TN TO TODAY TOKYO TOOLS TOP TOWN TOYS TP TR TRADE TRAINING TRAVEL TRUST TT TUI TV TW TZ UA UG UK UNIVERSITY UNO UOL US UY UZ VA VACATIONS VC VE VEGAS VENTURES VERSICHERUNG VET VG VI VIAJES VIDEO VILLAS VISION VLAANDEREN VN VODKA VOTE VOTING VOTO VOYAGE VU WALES WANG WATCH WEBCAM WEBSITE WED WEDDING WF WHOSWHO WIEN WIKI WILLIAMHILL WME WORK WORKS WORLD WS WTC WTF XXX XYZ YACHTS YANDEX YE YOGA YOKOHAMA YOUTUBE YT ZA ZIP ZM ZONE ZUERICH ZW";
  •  
  • // We'll keep track of which ones pass the isValid( "email" ) check.
  • accepted = [];
  • rejected = [];
  •  
  •  
  • // ------------------------------------------------------ //
  • // ------------------------------------------------------ //
  •  
  •  
  • // Sort the TLDs into the accepted / rejected collections.
  • for ( tld in listToArray( topLevelDomains, " " ) ) {
  •  
  • if ( isValid( "email", lcase( "ben@bennadel.#tld#" ) ) ) {
  •  
  • arrayAppend( accepted, tld );
  •  
  • } else {
  •  
  • arrayAppend( rejected, tld );
  •  
  • }
  •  
  • }
  •  
  •  
  • // ------------------------------------------------------ //
  • // ------------------------------------------------------ //
  •  
  •  
  • // Output the list of rejected emails / TLDs.
  • writeOutput( "Rejected Top-Level Domains (TLDs):" );
  • writeOutput( "<br /><br />" );
  •  
  • if ( arrayLen( rejected ) ) {
  •  
  • writeOutput( arrayToList( rejected, " " ) );
  •  
  • } else {
  •  
  • writeOutput( "! All TLDs accepted !" );
  •  
  • }
  •  
  •  
  • // ------------------------------------------------------ //
  • // ------------------------------------------------------ //
  •  
  •  
  • // Output the list of accepted emails / TLDs.
  • writeOutput( "<br /><br />" );
  • writeOutput( "Accepted Top-Level Domains (TLDs):" );
  • writeOutput( "<br /><br />" );
  •  
  • if ( arrayLen( accepted ) ) {
  •  
  • writeOutput( arrayToList( accepted, " " ) );
  •  
  • } else {
  •  
  • writeOutput( "! All TLDs rejected !" );
  •  
  • }
  •  
  • </cfscript>

First, I ran this in ColdFusion 10:

Rejected Top-Level Domains (TLDs):

ACCOUNTANTS AIRFORCE ALLFINANZ AMSTERDAM AQUARELLE ASSOCIATES ATTORNEY BARGAINS BLACKFRIDAY BLOOMBERG BNPPARIBAS BOUTIQUE BRUSSELS BUDAPEST BUILDERS BUSINESS CANCERRESEARCH CAPETOWN CATERING CHRISTMAS CLEANING CLOTHING COMMUNITY COMPUTER CONSTRUCTION CONSULTING CONTRACTORS CREDITCARD CUISINELLA DELIVERY DEMOCRAT DIAMONDS DIRECTORY DISCOUNT EDUCATION ENGINEER ENGINEERING ENTERPRISES EQUIPMENT EUROVISION EVERBANK EXCHANGE FEEDBACK FINANCIAL FIRMDALE FLSMIDTH FOUNDATION FURNITURE GRAPHICS HEALTHCARE HOLDINGS IMMOBILIEN INDUSTRIES INSTITUTE INTERNATIONAL INVESTMENTS LIGHTING MANAGEMENT MARKETING MARRIOTT MELBOURNE MEMORIAL MORTGAGE MOTORCYCLES PARTNERS PHARMACY PHOTOGRAPHY PICTURES PLUMBING PRODUCTIONS PROPERTIES PROPERTY REPUBLICAN RESTAURANT SAARLAND SERVICES SOFTWARE SOLUTIONS SUPPLIES TECHNOLOGY TRAINING UNIVERSITY VACATIONS VENTURES VERSICHERUNG VLAANDEREN WILLIAMHILL YOKOHAMA

Accepted Top-Level Domains (TLDs):

ABOGADO AC ACADEMY ACTIVE ACTOR AD ADULT AE AERO AF AG AGENCY AI AL ALSACE AM AN ANDROID AO AQ AR ARCHI ARMY ARPA AS ASIA AT AU AUCTION AUDIO AUTOS AW AX AXA AZ BA BAND BANK BAR BAYERN BB BD BE BEER BERLIN BEST BF BG BH BI BID BIKE BIO BIZ BJ BLACK BLUE BM BMW BN BO BOO BR BS BT BUILD BUZZ BV BW BY BZ BZH CA CAB CAL CAMERA CAMP CAPITAL CARAVAN CARDS CARE CAREER CAREERS CARTIER CASA CASH CAT CC CD CENTER CEO CERN CF CG CH CHANNEL CHEAP CHROME CHURCH CI CITIC CITY CK CL CLAIMS CLICK CLINIC CLUB CM CN CO COACH CODES COFFEE COLLEGE COLOGNE COM COMPANY CONDOS COOKING COOL COOP COUNTRY CR CREDIT CRICKET CRS CRUISES CU CV CW CX CY CYMRU CZ DAD DANCE DATING DAY DE DEALS DEGREE DENTAL DENTIST DESI DEV DIET DIGITAL DIRECT DJ DK DM DNP DO DOCS DOMAINS DOOSAN DURBAN DVAG DZ EAT EC EDU EE EG EMAIL EMERCK ENERGY ER ES ESQ ESTATE ET EU EUS EVENTS EXPERT EXPOSED FAIL FARM FASHION FI FINANCE FISH FISHING FIT FITNESS FJ FK FLIGHTS FLORIST FLOWERS FLY FM FO FOO FORSALE FR FRL FROGANS FUND FUTBOL GA GAL GALLERY GARDEN GB GBIZ GD GE GENT GF GG GGEE GH GI GIFT GIFTS GIVES GL GLASS GLE GLOBAL GLOBO GM GMAIL GMO GMX GN GOOGLE GOP GOV GP GQ GR GRATIS GREEN GRIPE GS GT GU GUIDE GUITARS GURU GW GY HAMBURG HAUS HELP HERE HIPHOP HIV HK HM HN HOLIDAY HOMES HORSE HOST HOSTING HOUSE HOW HR HT HU IBM ID IE IL IM IMMO IN INFO ING INK INSURE INT IO IQ IR IRISH IS IT IWC JE JETZT JM JO JOBS JOBURG JP JUEGOS KAUFEN KDDI KE KG KH KI KIM KITCHEN KIWI KM KN KOELN KP KR KRD KRED KW KY KZ LA LACAIXA LAND LAT LATROBE LAWYER LB LC LDS LEASE LEGAL LGBT LI LIDL LIFE LIMITED LIMO LINK LK LOANS LONDON LOTTE LOTTO LR LS LT LTDA LU LUXE LUXURY LV LY MA MADRID MAISON MANGO MARKET MC MD ME MEDIA MEET MEME MENU MG MH MIAMI MIL MINI MK ML MM MN MO MOBI MODA MOE MONASH MONEY MORMON MOSCOW MOV MP MQ MR MS MT MU MUSEUM MV MW MX MY MZ NA NAGOYA NAME NAVY NC NE NET NETWORK NEUSTAR NEW NEXUS NF NG NGO NHK NI NINJA NL NO NP NR NRA NRW NU NYC NZ OKINAWA OM ONG ONL OOO ORG ORGANIC OSAKA OTSUKA OVH PA PARIS PARTS PARTY PE PF PG PH PHOTO PHOTOS PHYSIO PICS PINK PIZZA PK PL PLACE PM PN POHL POKER PORN POST PR PRAXI PRESS PRO PROD PROF PS PT PUB PW PY QA QPON QUEBEC RE REALTOR RECIPES RED REHAB REISE REISEN REIT REN RENTALS REPAIR REPORT REST REVIEWS RICH RIO RIP RO ROCKS RODEO RS RSVP RU RUHR RW RYUKYU SA SALE SAMSUNG SARL SB SC SCA SCB SCHMIDT SCHULE SCHWARZ SCIENCE SCOT SD SE SEW SEXY SG SH SHIKSHA SHOES SHRIRAM SI SINGLES SJ SK SKY SL SM SN SO SOCIAL SOHU SOLAR SOY SPACE SPIEGEL SR ST SU SUPPLY SUPPORT SURF SURGERY SUZUKI SV SX SY SYDNEY SYSTEMS SZ TAIPEI TATAR TATTOO TAX TC TD TEL TF TG TH TIENDA TIPS TIRES TIROL TJ TK TL TM TN TO TODAY TOKYO TOOLS TOP TOWN TOYS TP TR TRADE TRAVEL TRUST TT TUI TV TW TZ UA UG UK UNO UOL US UY UZ VA VC VE VEGAS VET VG VI VIAJES VIDEO VILLAS VISION VN VODKA VOTE VOTING VOTO VOYAGE VU WALES WANG WATCH WEBCAM WEBSITE WED WEDDING WF WHOSWHO WIEN WIKI WME WORK WORKS WORLD WS WTC WTF XXX XYZ YACHTS YANDEX YE YOGA YOUTUBE YT ZA ZIP ZM ZONE ZUERICH ZW

As you can see, a large number of the new top-level domains were accepted; however, a large number were also rejected.

I then took this same exact code and ran it through a new install of ColdFusion 11:

Rejected Top-Level Domains (TLDs):

! All TLDs accepted !

Accepted Top-Level Domains (TLDs):

ABOGADO AC ACADEMY ACCOUNTANTS ACTIVE ACTOR AD ADULT AE AERO AF AG AGENCY AI AIRFORCE AL ALLFINANZ ALSACE AM AMSTERDAM AN ANDROID AO AQ AQUARELLE AR ARCHI ARMY ARPA AS ASIA ASSOCIATES AT ATTORNEY AU AUCTION AUDIO AUTOS AW AX AXA AZ BA BAND BANK BAR BARGAINS BAYERN BB BD BE BEER BERLIN BEST BF BG BH BI BID BIKE BIO BIZ BJ BLACK BLACKFRIDAY BLOOMBERG BLUE BM BMW BN BNPPARIBAS BO BOO BOUTIQUE BR BRUSSELS BS BT BUDAPEST BUILD BUILDERS BUSINESS BUZZ BV BW BY BZ BZH CA CAB CAL CAMERA CAMP CANCERRESEARCH CAPETOWN CAPITAL CARAVAN CARDS CARE CAREER CAREERS CARTIER CASA CASH CAT CATERING CC CD CENTER CEO CERN CF CG CH CHANNEL CHEAP CHRISTMAS CHROME CHURCH CI CITIC CITY CK CL CLAIMS CLEANING CLICK CLINIC CLOTHING CLUB CM CN CO COACH CODES COFFEE COLLEGE COLOGNE COM COMMUNITY COMPANY COMPUTER CONDOS CONSTRUCTION CONSULTING CONTRACTORS COOKING COOL COOP COUNTRY CR CREDIT CREDITCARD CRICKET CRS CRUISES CU CUISINELLA CV CW CX CY CYMRU CZ DAD DANCE DATING DAY DE DEALS DEGREE DELIVERY DEMOCRAT DENTAL DENTIST DESI DEV DIAMONDS DIET DIGITAL DIRECT DIRECTORY DISCOUNT DJ DK DM DNP DO DOCS DOMAINS DOOSAN DURBAN DVAG DZ EAT EC EDU EDUCATION EE EG EMAIL EMERCK ENERGY ENGINEER ENGINEERING ENTERPRISES EQUIPMENT ER ES ESQ ESTATE ET EU EUROVISION EUS EVENTS EVERBANK EXCHANGE EXPERT EXPOSED FAIL FARM FASHION FEEDBACK FI FINANCE FINANCIAL FIRMDALE FISH FISHING FIT FITNESS FJ FK FLIGHTS FLORIST FLOWERS FLSMIDTH FLY FM FO FOO FORSALE FOUNDATION FR FRL FROGANS FUND FURNITURE FUTBOL GA GAL GALLERY GARDEN GB GBIZ GD GE GENT GF GG GGEE GH GI GIFT GIFTS GIVES GL GLASS GLE GLOBAL GLOBO GM GMAIL GMO GMX GN GOOGLE GOP GOV GP GQ GR GRAPHICS GRATIS GREEN GRIPE GS GT GU GUIDE GUITARS GURU GW GY HAMBURG HAUS HEALTHCARE HELP HERE HIPHOP HIV HK HM HN HOLDINGS HOLIDAY HOMES HORSE HOST HOSTING HOUSE HOW HR HT HU IBM ID IE IL IM IMMO IMMOBILIEN IN INDUSTRIES INFO ING INK INSTITUTE INSURE INT INTERNATIONAL INVESTMENTS IO IQ IR IRISH IS IT IWC JE JETZT JM JO JOBS JOBURG JP JUEGOS KAUFEN KDDI KE KG KH KI KIM KITCHEN KIWI KM KN KOELN KP KR KRD KRED KW KY KZ LA LACAIXA LAND LAT LATROBE LAWYER LB LC LDS LEASE LEGAL LGBT LI LIDL LIFE LIGHTING LIMITED LIMO LINK LK LOANS LONDON LOTTE LOTTO LR LS LT LTDA LU LUXE LUXURY LV LY MA MADRID MAISON MANAGEMENT MANGO MARKET MARKETING MARRIOTT MC MD ME MEDIA MEET MELBOURNE MEME MEMORIAL MENU MG MH MIAMI MIL MINI MK ML MM MN MO MOBI MODA MOE MONASH MONEY MORMON MORTGAGE MOSCOW MOTORCYCLES MOV MP MQ MR MS MT MU MUSEUM MV MW MX MY MZ NA NAGOYA NAME NAVY NC NE NET NETWORK NEUSTAR NEW NEXUS NF NG NGO NHK NI NINJA NL NO NP NR NRA NRW NU NYC NZ OKINAWA OM ONG ONL OOO ORG ORGANIC OSAKA OTSUKA OVH PA PARIS PARTNERS PARTS PARTY PE PF PG PH PHARMACY PHOTO PHOTOGRAPHY PHOTOS PHYSIO PICS PICTURES PINK PIZZA PK PL PLACE PLUMBING PM PN POHL POKER PORN POST PR PRAXI PRESS PRO PROD PRODUCTIONS PROF PROPERTIES PROPERTY PS PT PUB PW PY QA QPON QUEBEC RE REALTOR RECIPES RED REHAB REISE REISEN REIT REN RENTALS REPAIR REPORT REPUBLICAN REST RESTAURANT REVIEWS RICH RIO RIP RO ROCKS RODEO RS RSVP RU RUHR RW RYUKYU SA SAARLAND SALE SAMSUNG SARL SB SC SCA SCB SCHMIDT SCHULE SCHWARZ SCIENCE SCOT SD SE SERVICES SEW SEXY SG SH SHIKSHA SHOES SHRIRAM SI SINGLES SJ SK SKY SL SM SN SO SOCIAL SOFTWARE SOHU SOLAR SOLUTIONS SOY SPACE SPIEGEL SR ST SU SUPPLIES SUPPLY SUPPORT SURF SURGERY SUZUKI SV SX SY SYDNEY SYSTEMS SZ TAIPEI TATAR TATTOO TAX TC TD TECHNOLOGY TEL TF TG TH TIENDA TIPS TIRES TIROL TJ TK TL TM TN TO TODAY TOKYO TOOLS TOP TOWN TOYS TP TR TRADE TRAINING TRAVEL TRUST TT TUI TV TW TZ UA UG UK UNIVERSITY UNO UOL US UY UZ VA VACATIONS VC VE VEGAS VENTURES VERSICHERUNG VET VG VI VIAJES VIDEO VILLAS VISION VLAANDEREN VN VODKA VOTE VOTING VOTO VOYAGE VU WALES WANG WATCH WEBCAM WEBSITE WED WEDDING WF WHOSWHO WIEN WIKI WILLIAMHILL WME WORK WORKS WORLD WS WTC WTF XXX XYZ YACHTS YANDEX YE YOGA YOKOHAMA YOUTUBE YT ZA ZIP ZM ZONE ZUERICH ZW

As you can see, all of the known top-level domains are accepted in ColdFusion 11.

At this point, I think that many people have abandoned the isValid() function due to its historical inaccuracies. But, still, it's nice to see that some progress was made in ColdFusion 11.




Reader Comments

Ben wrote:
> all of the known top-level domains

Your list doesn't contain ".???" or ".??"

Chris wrote:
> Do they accept invalid TLDs too? Maybe they just
> accept anything after the final period...hmmm

There's no such thing as an "invalid TLD".

An email address is made up of two parts, separated by an @ symbol.

The first part - the mailbox - can contain almost any character (though some need escaping).

The second part is a hostname/domain, identifying where that mailbox resides.
If it uses an Internet top-level domain then Internet-connected machines know how to deliver it.
If it uses a local hostname only, or a domain that is resolved outside of typical DNS, it's still a valid address - even if most machines don't know how to resolve it. (i.e. it's not an "invalid" TLD, it's simply not a TLD.)

The address made.up@hotmail.com is no more/less valid as name@made.up

Reply to this Comment

@Peter, @Chris,

So, after what you guys said, I tried to run this:

  • <cfscript>
  • writeOutput( isValid( "email", "ben@" ) & "<br />" );
  • writeOutput( isValid( "email", "ben@.com" ) & "<br />" );
  • writeOutput( isValid( "email", "ben@foobar" ) & "<br />" );
  • writeOutput( isValid( "email", "ben@foobar.madeup" ) & "<br />" );
  • writeOutput( isValid( "email", "ben@foobar.something-crazy" ) & "<br />" );
  • </cfscript>

In ColdFusion 11, it renders:

NO
NO
YES
YES
YES

It seems that Peter is right, not only from a philosophical sense, but also from a technical sense. Apparently ColdFusion 11 will accept anything (within technical reason) that is separated by "@".

If I run the same code through ColdFusion 10, I get:

NO
NO
NO
YES
NO

Very interesting!

Reply to this Comment

I tried this same code on Railo 4.2.1. All TLD's in the inital code were successful. Added madeup and something-crazy to the list. madeup was successful, something-crazy failed.

Reply to this Comment

@Tom,

Yeah, this code (blog code) is pretty old :( I don't think I even knew that UTF-8 was a "thing" when I built it :D

@Mike,

Ah, good to know. Thanks for checking that.

Reply to this Comment

I'm still using ColdFusion 9 for many applications and have access to better email validation than ColdFusion 11 by using Dominic Sayers' IsEMail java library. (I explored using a regex, but it required too many special rules.) The library can additionally test the domain's MX record to determine if email is configured for a domain. It also returns the reasoning behind why a domain name isn't valid. (NOTE: I prefer to skip MX checking when validating large lists. Even though it performs DNS Lookup caching (w/TTL), it can take a while and cause a timeout error if it takes too long.)
http://isemail.info/

To compare results, I tested the same TLDs w/DNS checking enabled. The following 91 TLDs are the only ones that have a valid MX record. (Rule #0; ISEMAIL_VALID; Address is valid.)
ACTIVE ADULT AMSTERDAM ANDROID AQUARELLE AUTOS BOO CAL CARTIER CHANNEL CHROME COACH COM CRICKET DAD DAY DELIVERY DEV DOCS DOOSAN EAT EMERCK ENERGY ESQ EUROVISION EVERBANK FASHION FIRMDALE FIT FLOWERS FLY FM GARDEN GBIZ GGEE GLE GMAIL GOOGLE HERE HOMES INFO ING IRISH IWC KDDI LATROBE LDS LEGAL LIDL LOTTE LOTTO MADRID MARRIOTT ME MEET MEME MEMORIAL MOBI MONEY MORMON MOTORCYCLES MOV NEW NEXUS NGO ONG ORG OSAKA PARTY POKER PORN PROD PROF REIT RSVP SALE SAMSUNG SCHWARZ SCIENCE SEW SHRIRAM SYDNEY TAIPEI TIRES TRUST TV VIDEO WS YACHTS YOUTUBE ZUERICH

Everything else failed with "Rule #73; ISEMAIL_DOMAINNOTFOUND; Couldn't find an MX-record or an A-record for this domain."

Reply to this Comment

The unicode chars appear ok in the email notifications, which presumably means they're in the database ok and you just need to check if the CFML is setting charset/encoding to iso-8859-1 or windows-1252 anywhere and fix it to utf-8.

Reply to this Comment

@Peter,

So frustrating. I have it set to UTF-8 in the CFContent tag; and, I have a UTF-8 Meta tag in the page header. Grrr!

Reply to this Comment

@James,

I still run some CF9 in production and have basically fallen-back to using logic that is replaces the ending with ".com" strictly for the validation. So, basically, every email address gets validated as the same TLD. It was a quick fix to respond to a user ticket.

Reply to this Comment

@Stephen,

Yeah, it still breaks on anything that is "malformed". Or, at least, obviously malformed.

Reply to this Comment

"Yeah, it still breaks on anything that is "malformed". Or, at least, obviously malformed."
That's all you can reasonably do with a passive server side check. The only way to know is to send the address a link to click.

Reply to this Comment

Have you ever considered creating a fuction that queries the mail server for a callback verification to check that the email not only is valid but also really exits within the domain.

Reply to this Comment

Yes, but this is pointless. Modern mail servers do not allow you to check for user accounts (because spam). And mail delivery can take minutes (a long time for a call back to wait in a web request). And just because you get accepted, doesn't mean it won't bounce in future.

Reply to this Comment

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
Oops!
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.