That email check isn't down to me. It was in the original ContactMe snippet.
It looks up to check that the domain name actually exists.
There are many ways to extend the ability to check email addesses.
One is to use regular expressions to determine if the email address actually conforms to what is allowed in an email address. Problem is, I haven't found a regular expression that actually properly checks all possibilities. Most of them make assumptions that may be valid in most circumstances, but not all. They all seem to not fully implement the standard.
2006-01-19 UPDATE: I've now found a function I'm happy with to validate email addresses against the RFC822 standard. It's included in the
EnergyAgreement snippet.
The next way is to actually try and validate the email address given. After all, an address that conforms may quite possibily be an email address that doesn't exist.
This snippet checks that the domain name exists. But still, that's not really enough. for example the domain name borrett.id.au exists, but the email address ted@borrett.id.au doesn't exist.
So the next move would be to verify that the actual email address exist for that domain name. Problem is, not all mail servers support the mechanisms available to do that.
So in the end, the level of checking done is very much a compromise.
I've created many variations of the ContactMe snippet previously. The reason I submitted this one is because it does try to address the problem of such contact forms being used by spammers. And I think with the given rise on insertion type attacks, it's about time we all addressed this on our web sites.
Best Regards, Lloyd.
Edited by lloyd_borrett, 19 January 2006 - 10:37 AM.