alwaysvaghu Posted November 12, 2005 Share Posted November 12, 2005 Hi frnds...How Can I check that entered email address is valid or not...???I mean HOw can i check validity of that email address Link to comment Share on other sites More sharing options...
Paim Posted November 12, 2005 Share Posted November 12, 2005 Send a confirmation email that they have to reply to I guess. I have NO idea how to do that though. Link to comment Share on other sites More sharing options...
alwaysvaghu Posted November 12, 2005 Author Share Posted November 12, 2005 I want this bcaz we r also doing broadcasting and other things..some times if i m performing broadcasting for 500 email and there are more that 75% emails are invalid..(the S/W shows that)so it is just wasting of time.....so plz Link to comment Share on other sites More sharing options...
Kcarson Posted November 12, 2005 Share Posted November 12, 2005 If you are referring to checking to make sure it at least could be an address, meaning it has the @ symbol and a .com/org/net, etc. at the end, then you could do that with Javascript first before they send it to you. Another popular method I have seen to validate e-mail addresses is to make the user enter the address twice and check that both entries are the same. Using these two methods with the e-mail send out mentioned above would help to greatly reduce your number of invalid addresses . Link to comment Share on other sites More sharing options...
jameslee Posted November 15, 2005 Share Posted November 15, 2005 use javascript validations.regex. Link to comment Share on other sites More sharing options...
maelstorm Posted November 15, 2005 Share Posted November 15, 2005 function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("[^@]{1,64}@[^@]{1,255}", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true;}if (check_email_address($email)) { echo $email . ' is a valid email address.';} else { echo $email . ' is not a valid email address.';} Check if this is what you wanted... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now