...

View Full Version : check email existance



sahar
08-03-2006, 09:51 AM
can anybody help me validate email address by check a passed email address is a ‘real/existance’ address or not?

for example
boa@yahoo.com
abc@gmail.com
xhju@jhjfd.com

thank in advance

Reveller
08-03-2006, 02:09 PM
You can go anywhere from very simple to very complex in checking whether the syntax of an email address is correct. The most simple solution would be:


function isValidEmail(str) {
return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

But is is hardly bulletproof. Better would be using a Regex to validate email syntax, i.e


function checkMail(emailInput) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(x)) alert('YES! Correct email address');
else alert('NO! Incorrect email address');
}

Check Google for "javascript email validation". Checking whether an email address also actually exists is much harder, and you need PHP (or any other serverside language) and a configurable mailserver for that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum