Aaron Longnion asked if I could modify the email validation on my blog to allow the + character in email addresses. Apparently in gmail you can add +anything to your email address (after the username and before the @ character) and it will still arrive in your account. This helps people organize emails that come from filling out online forms, or signing up for newsletters, or commenting on blogs or whatever. I went ahead and modified the isEmail function that BlogCFC uses to accommodate this, and then thought I would share it with the world just in case someone asks you fix your blog too.

[More]

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
James Moberg's Gravatar What happens to regular expression email validation when domain names like "arstechnica.awesome" or "google.thegoogle" become mainstream?
http://arstechnica.com/news.ars/post/20080626-conf...
# Posted By James Moberg | 6/26/08 5:58 PM
Scott Bennett's Gravatar I don't see a lot of people forking out the 100k to 500k money to create a TLD like .awesome, but I was reading about that earlier today. I am not sure what all the rules are for what characters will be allowed or how long the TLD string can be, but it my best guess is the RegEx would be something like:

^['_a-z0-9-]+(\.['_a-z0-9-]+)*(\+['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z0-9-]+)$
# Posted By Scott Bennett | 6/26/08 6:26 PM
Dave Shuck's Gravatar I have modified all my email validation to allow plus signs, but I make use of ColdFusion's IsValid method.

Something like:
IsValid("Email",Replace(EmailAddress),"+",""))

It isn't nearly as impressive to look at as the regex example, but I am not sure that it is any less effective! :)
# Posted By Dave Shuck | 6/26/08 6:39 PM
Scott Bennett's Gravatar @Dave.

That would probably work for the most part, but what if someone puts a + in a part of the email address where it doesn't belong, that will pass your validation too like:

+comment.spammer@fakedomain.com
or
comment.spammer@fake+domain.com

The RegEx gives you a little more sophistication, and you get to feel smart because you can understand all that goblie-gook.
# Posted By Scott Bennett | 6/26/08 7:09 PM
Raymond Camden's Gravatar Thanks for doing this. I've added it to the 5.9.1 release.
# Posted By Raymond Camden | 7/29/08 2:59 PM
mirc's Gravatar thanks you.
# Posted By mirc | 11/24/08 8:22 AM
Jayne's Gravatar This was just what I was looking for, great resource. Bookmarked. http://www.sharevouchers.co.uk/2009/05/18/vistapri...
# Posted By Jayne | 5/19/09 12:21 AM
 
Home | Blog | Portfolio | Contact | © 2001 - 2007 The ColdFusion Guy - Scott Bennett. All rights reserved.
BlogCFC was created by Raymond Camden. This blog is running version 5.9.