tracker issue : CF-4204100

select a category, or use search below
(searches all categories and all time range)
Title:

isValid("email") shouldn't ignore a "display name"

| View in Tracker

Status/Resolution/Reason: To Fix//Investigate

Reporter/Name(from Bugbase): James M. / ()

Created: 03/15/2019

Components: Language, Functions

Versions: 2016

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: CF 11, 2016 & 2018... /

Priority/Frequency: Normal / Most users will encounter

Locale/System: English / Win 2016

Vote Count: 1

Problem Description:
An email address consists of a “local-part, an @ symbol, then a case-insensitive domain... at least this is how it worked all the way up until ColdFusion 11 when an additional "display name" started being allowed.

Steps to Reproduce:
<CFSET TestEmail = '"Testy McTest" <test@test.com>'>
<CFDUMP VAR="#isValid('email', TestEmail)#">

Actual Result:
YES

Expected Result:
NO

Any Workarounds:
Write your own UDF and check for quotes, brackets or spaces. It's not perfect, but better than validating the entire "display name" + "email" as an valid email address and then passing it to third-party validation and having it fail.
<cfscript>
function isEmail(inputString)
	if (refind("\<|\>|""|#Chr(32)#", arguments.inputString){
		return false;
	}
	return isValid("email", arguments.inputString);
}
</cfscript>

Attachments:

Comments: