views:

674

answers:

7

We are looking to improve our marketing email list by preventing fake emails from entering in the first place. We want to confirm that an email address exists (and that there is actually a mailbox for that email address).

Does anyone know of any services or components to validate an email address?

A: 

Hi Jeff, the following regular expression is an example of how you could validate an email address is in the correct general format:

(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})

For security reasons, very few email servers provide a function to remotely validate whether or not a mailbox exists, so it is very unlikely a service could provide this information with any reliability.

Hope this helps!

Adam

Adam Alexander
This just validates that a string conforms to a particular format. But he asked how to confirm that a mailbox for an email address exists.
Eoin Campbell
Hi Adam, This is the top level validation that we are already doing. We want to take it to the next level and validate that the domain exists and then that there is actually a mailbox by the name specified on the mail server.
Jeff Widmer
I just thought I'd throw that regex in there in case you weren't already doing something similar. In response to your second question "Does anyone know of any services or components to validate an email address" I stand by my answer that a service or component can't very reliably give you that
Adam Alexander
Domain you can do - just look up whether there's an MX record for that domain. Mailbox you can't (generally) without sending another email. See my answer.
Paul
Sure, but the MX record could be pointing to an invalid hostname or IP. If it exists, port 25 may be closed but even if port 25 is open the server may not be configured to accept outside email. This question can be answered at many levels and I am not sure why my suggestions merited a down vote.
Adam Alexander
You both went further and provided a procedure, when the question asked for a service or component. Nothing wrong with that, I upvoted you both. I was going for a more direct answer to his question which I believe was a reasonable answer also. I apologize if anyone feels this didn't add anything.
Adam Alexander
Besides, that regex is so weak, there are plenty of invalid email addresses that would incorrectly pass...
Ricardo Villamil
Yes, I believe my statement "an example of how you could validate an email address is in the correct general format" did not leave the impression the example was meant to be a complete and bulletproof solution. The inability to completely solve this was a big part of the point I was trying to make.
Adam Alexander
+3  A: 

It would be quite trivial to do this yourself.

  1. Create a webform where the user can type in their email address. You could protect it with a captcha to prevent bots from hitting it.

  2. On submission, save the email address to a database along with a GUID, DateTime timestamp and IsActivated bit. The GUID uniquely identifies this subscription. The timestamp states an expiry time that the email address must be confirmed by.

  3. Send an email to the email address with a URL in it like.

    http://www.example.com/validate.aspx?g=GUID-GOES-HERE

  4. If user receives the email in their inbox & clicks the validation link before the timestamp for that GUID/Email expires, then you activate their account.

  5. At regular intervals you could have a job remove rows from the table that have never been activated where the activation window has expired.

Eoin Campbell
Hi Eoin, This is a great idea but would add too much development time to our current order processing engine and change email address page. We don't want to have to change how customers sign up for our products but just hook into the current checkout and change email address pages.
Jeff Widmer
+3  A: 

You can't really validate an email address without sending a message to it, and perhaps not even then (you may or may not get an error response or error message).

And if you're sending an email to validate it, you're probably going to irritate your recipients, unless you add value in that email.

The normal way of doing this is to send an email to the address you're given, which contains a unique link which when the user visits it, confirms that the user had received the email and (presumably) really wants your email in future. Was this what you meant, or did you really want to validate the message without sending an email to the user?

If it is, there are any number of list managers that can do this (for instance, Gnu mailman). Searching for "email list managers" shows up many more, including firms that will manage the list for you.

Paul
A: 

There are several levels of email validation and I've got source to do them all. However, I despise your line of business and would never share them with you...

Just to clarify - I don't despise you, Jeff... Just your line of business.

mson
Hi mson,Not sure i understand your answer or why you would despise my line of business... we just want to make sure we have a clean list of email addresses when people order our product.
Jeff Widmer
mson: would you add more explanation - this answer can easily be accepted as offensive.
Sunny
Not entirely sure it was a helpful response to the question to let us know your opinion on the poster's business.
Paul
+1  A: 

Here is an article on what we want to do: http://www.coveryourasp.com/ValidateEmail.asp

We want to do DNS Validation and SMTP Validation. We already have Simple Validation in place.

Jeff Widmer
You may validate for a valid domain, but you can't validate for an existence and status of an account/inbox without sending a message and getting a response back via a unique URL click from the email.
Kon
Good link with several options
Adam Alexander
If you use simple validation as described in that article, you're actually denying a great many valid email addresses. The valid email syntax is surprisingly complex, so the best validation technique really is to try to send an email.
Greg D
My completely valid personal email address "fails" the SMTP check on that page.
Paul
Hi Paul, Does you personal email address pass this components test: http://www.aspnetmx.com/demo.aspx.
Jeff Widmer
A: 

I found these two components:

We most likely will be going with one of them. Probably go with aspNetMx from Advanced Intellect (at least that is where I am leaning right now). The sample test on http://www.aspnetmx.com/demo.aspx worked for my email addresses (valid and not valid).

And will probably just go with DNS Validation and not SMTP validation since a couple comments have indicated that SMTP validation is not 100% accurate and also the amount of delay that occurs with SMTP validation.

-Jeff

Jeff Widmer
A: