The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Email validation

Almost all sites validate your email address as part of the account creation process by sending a email to the account with some instructions to proceed.
I googled for open source packages that can help me do this for my application but surprisingly, couldnt find one.
How do you handle email validations in your app?
wannabe boy
Thursday, May 12, 2005
In Perl I just use Email::Valid.
Ryan Anderson Send private email
Thursday, May 12, 2005
Why not look at the source code for phpBB?  It is open source and they do all of that kind of stuff.
Thursday, May 12, 2005
How far do you want to go? Ultimately the only way to validate an e-mail address is to send mail to it. Virtually any string with an @ sign in it is potentially a valid e-mail address. 

If you're mainly concerned about handling the common cases (no fidonet, no uucp, etc) the method you choose should accept:

- More or less any character on the left side of the @ sign. In particular be sure to accept -, _, +, and ..
- Any valid domain name on the right side of the @ sign with the possible exception of IDN names. The list of characters allowed in a domain name is probably larger than you realize. Check the appropriate reference. I suggest allowing any TLD rather than checking a list of new TLDs. Even if your list is accurate today, it won't be tomorrow.
comp.lang.c refugee
Thursday, May 12, 2005
I think previous answers are missing the point. I dont think he wants to ensure that the email address syntax is valid, rather that the email address entered belongs to the person who is requesting to create an account or whatever.

I usually handle this by having a bit/boolean field in the accounts table called isValidated or the like and a field to contain a unique token (not an auto id though!). This defaults to 0/false and the account can not be logged into at this stage.

When a user signs up, a unique token is generated and stored in the database, then an email is sent to them containing a link in the form:<uniquetoken>

Upon clicking the link, the account relating to the unique token gets marked as validated and the user can now login.

I use a unique token instead of an auto id or the email address because given one auto id, it would be easy to guess the next in the series and people could then fake the confirmation by crafting the URL.
Joe Send private email
Friday, May 13, 2005
I would do exactly the same thing that you described. And probably many of us who want this functionality would do it more or less the same way. And that is why, I am wondering if there is any library/component that anyone knows of that I can use of the shelf for this purpose.

Thanks for all the responses
wannabe boy
Friday, May 13, 2005
Email validation is usually a tricky process. Validating an email address by syntax is usually not enough.

You also need to validate whether the domain actually exists, moreover whether that domain has any MX records (mail servers). To make thing more complicated, you can even try to connect to the mail server and attempt to send a message to that user to see whether the mail server accepts or rejects the message (non-existing user maybe). Of course, you should not finalize sending the message, just disconnect after mail server tells you if it accepts or rejects the message.

To automate all of the above, you can use a library such as devMX.Net Email Validation Component for .NET. See for details.
Hakan Send private email
Saturday, May 14, 2005
> You also need to [...]

And, after all that, you probably need to verify that the owner of that email address actually wants your email. Doing this automatically requiers more than just checking DNS records.  :)

Monday, May 16, 2005
Nice idea, a "recipient validator" ;)
Hakan Send private email
Monday, May 16, 2005

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz