Fritz_Doll Posted December 11, 2010 Share Posted December 11, 2010 PHP has it's nice filter to check if an email follows a valid email format, but how do i check if the email exists? Link to comment Share on other sites More sharing options...
gar onn Posted December 11, 2010 Share Posted December 11, 2010 function EmailValidation($email) { $email = htmlspecialchars(stripslashes(strip_tags($email))); //parse unnecessary characters to prevent exploits if ( eregi ( '[a-z||0-9]@[a-z||0-9].[a-z]', $email ) ) { //checks to make sure the email address is in a valid format $domain = explode( "@", $email ); //get the domain name if ( @fsockopen ($domain[1],80,$errno,$errstr,3)) { //if the connection can be established, the email address is probabley valid return true; /* GENERATE A VERIFICATION EMAIL */ } else { return false; //if a connection cannot be established return false } } else { return false; //if email address is an invalid format return false } } Found this with google... Link to comment Share on other sites More sharing options...
Fritz_Doll Posted December 11, 2010 Author Share Posted December 11, 2010 all it does is verify that the domain exists, not the email.an example $email was "flargleinglelop@yahoo.com" <- i know the domain exists.I also went to yahoo and went to the sign up form, "flargleinglelop@yahoo.com" is available to take.however the script outputs True, which is wrong. Link to comment Share on other sites More sharing options...
[dx] Posted December 11, 2010 Share Posted December 11, 2010 What about if someone uses personal domain which is not in your script. For example user@w3schools.com How will you check then? Don't bother yourself with it. Link to comment Share on other sites More sharing options...
Fritz_Doll Posted December 11, 2010 Author Share Posted December 11, 2010 So, just take their word that they are submitting a valid address? I guess I could, It's for account validation and password recovery. I'll just put a flag on their account until they validate their email (They'll just have some trouble getting their password back if it isn't valid). Link to comment Share on other sites More sharing options...
boen_robot Posted December 12, 2010 Share Posted December 12, 2010 You could send a confirmation email... that's how this forum does it - send a unique email with a link they must go to. When the unique URL is accessed, assume it came from the email and mark it as existant. Link to comment Share on other sites More sharing options...
Fritz_Doll Posted December 12, 2010 Author Share Posted December 12, 2010 So just assume it exists, then verify that it exists if I get a response. I'll try that. Link to comment Share on other sites More sharing options...
Fmdpa Posted December 12, 2010 Share Posted December 12, 2010 If you are doing this for a login, then Boen_robot's suggestion is the best. Many login systems these days are dependent upon a valid email address. You could automatically generate a password, then send it to that email address. If the individual signing up knows this, then they'll will most likely enter a valid address. Link to comment Share on other sites More sharing options...
thescientist Posted December 12, 2010 Share Posted December 12, 2010 So just assume it exists, then verify that it exists if I get a response. I'll try that.i guess. Force them to prove to you its real, by having the user follow up with a confirmation email. Link to comment Share on other sites More sharing options...
Fritz_Doll Posted December 14, 2010 Author Share Posted December 14, 2010 I like that suggestion, generate a password. If they log in with the password I give them, then I'll change their password to what they had desired. Thanks for the suggestions! Link to comment Share on other sites More sharing options...
thescientist Posted December 14, 2010 Share Posted December 14, 2010 I like that suggestion, generate a password. If they log in with the password I give them, then I'll change their password to what they had desired. Thanks for the suggestions!Passwords, I though this was about emails? Regardless after they login, or authorize, or whatever, just set a flag in their profile in the DB somewhere from false to true, or from inactive, to active, or something like that, to confirm their email is authentic. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.