myleow wrote:I do have the activation link. I just want to make it so that i won't be sending out bad emails, and catching it on the spot while the user is still waiting on adding that email would be a much faster and better way to encourage them to put in valid email address.
someone@somewhere.com is a favourite.
well, the thing is its not always possible to know if an email is valid or not unless you fire off an email w/ a confirm link in it.
contacting the receiving server and trying to verify it imo is not a solution at all, because the reply you get will never tell you if the mailbox really exists or not. maybe the server denies the verify query, or maybe the server sais its always valid because they have a catch all mailbox.
also, what if thier mailbox is full, and your email would bounce?
really, imo the only good way is to do a very basic check on the email making sure the syntax is valid, and then fire an email and make em confirm it.
i dont even like to use complex regular expressions to try to validate the email first, because _some_ emails do exist and are definately valid, that do not neccesarily follow the rfc syntax. that and it is pretty difficult to validate an email to rfc specs anyway. this is all i use:
Code: Select all
function could_be_email($email) {
return preg_match('/^[^@]{1,64}@[^@]{4,255}$/', $email);
}
if it passes that basic validation, i give it chance and fire an email for them to confirm. if it doesnt, i notify the user that their email is invalid, because if it cannot at least pass that basic syntax validation, it is certainly not valid.
i understand your desire to not even send emails out that may be pointless, but its very difficult to determine if they are truely pointless until after you have done it. unless you can be sure an email is invalid(and generally you cant), its may not be worth the risk of not giving it a chance by sending out a confirmation email.