Last active
August 29, 2015 14:25
-
-
Save iconecd/7cacd2bac665ba8eab49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
public boolean function isValidEmail ( | |
required string email | |
) { | |
var ia = CreateObject( "java", "javax.mail.internet.InternetAddress" ); | |
ia.setAddress( arguments.email ); | |
try { | |
ia.validate(); | |
} catch ( any e ) { | |
return false; | |
} | |
return REFindNoCase( "^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name|travel))$", arguments.email ); | |
} | |
writedump( isvalidemail('') ); | |
writedump( isvalidemail('jake') ); | |
writedump( isvalidemail('jake@jake') ); | |
writedump( isvalidemail('jake.jake') ); | |
writedump( isvalidemail('[email protected]') ); | |
writedump( isvalidemail('[email protected]') ); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment