Guest Posted August 29, 2013 Posted August 29, 2013 For some unknown reason I keep getting invalided email address errors when signing up for a new account. No matter what email address I use it comes up as invalid. I have no idea where to even start to locate the issue causing this error and I cant afford to hire a web developer to fix it for me :( Is this a common issue? Any ideas how I could go about diagnosing the issue? Thanks in advance!!!
Bob Terveuren Posted August 29, 2013 Posted August 29, 2013 Hi In the file create_account.php at around line 87 there's the validation code for email addresses: [b] if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {[/b] $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR); [b] } elseif (tep_validate_email($email_address) == false) {[/b] $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } else { Two places it can throw you out - the first line - ENTRY_EMAIL_ADDRESS_MIN_LENGTH - make sure that your minimum value in Admin > Configuration > E-mail address is not set to something huge (default is 6) If that's OK then it's tep_validate_email and you'll find that in includes/functions/validations.php - there's a couple of places in there that may be the problem but the one to try first is check that the admin entry Admin > Configuration >Verify E-Mail Addresses Through DNS is set to false
Guest Posted September 1, 2013 Posted September 1, 2013 Hello Bob, Thanks for your reply. My current settings are exactly what you mentioned above. Minimum e-mail address value is @ 6. and the verify through email is set to false. However its still not working :(
Chris H Posted September 1, 2013 Posted September 1, 2013 There is also the 'duplicate email address' error message Your E-Mail Address already exists in our records - please log in with the e-mail address or create an account with a different address. Is that what you are seeing? It is all too easy, whilst testing, to repeatedly use the same address.
Guest Posted September 1, 2013 Posted September 1, 2013 Thanks for your reply Chris. However that don't seem to be it. I have tried many different emails. Here is the exact error message I get Your E-Mail Address does not appear to be valid - please make any necessary corrections.
Guest Posted September 3, 2013 Posted September 3, 2013 Bob what other things are you talking about in includes/functions/validations.php?
Bob Terveuren Posted September 6, 2013 Posted September 6, 2013 Hi there If you look at the file there's a load of stuff at the head of it that say a bit about what it does: //////////////////////////////////////////////////////////////////////////////////////////////// // // Function : tep_validate_email // // Arguments : email email address to be checked // // Return : true - valid email address // false - invalid email address // // Description : function for validating email address that conforms to RFC 822 specs // // This function will first attempt to validate the Email address using the filter // extension for performance. If this extension is not available it will // fall back to a regex based validator which doesn't validate all RFC822 // addresses but catches 99.9% of them. The regex is based on the code found at // http://www.regular-expressions.info/email.html // // Optional validation for validating the domain name is also valid is supplied // and can be enabled using the administration tool. // // Sample Valid Addresses: // // first.last@[member='host'].com // firstlast@[member='host'].to // first-last@[member='host'].com // first_last@[member='host'].com // // Invalid Addresses: // // first last@[member='host'].com // first@[member='Last']@[member='host'].com // //////////////////////////////////////////////////////////////////////////////////////////////// Below that you get all the fancy code stuff: function tep_validate_email($email) { $email = trim($email); if ( strlen($email) > 255 ) { $valid_address = false; } elseif ( function_exists('filter_var') && defined('FILTER_VALIDATE_EMAIL') ) { $valid_address = (bool)filter_var($email, FILTER_VALIDATE_EMAIL); } else { if ( substr_count( $email, '@' ) > 1 ) { $valid_address = false; } if ( preg_match("/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i", $email) ) { $valid_address = true; } else { $valid_address = false; } } if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') { $domain = explode('@', $email); if ( !checkdnsrr($domain[1], "MX") && !checkdnsrr($domain[1], "A") ) { $valid_address = false; } } return $valid_address; } Here's my take on what all that does function tep_validate_email($email) { //first chop off any whitespace fore and aft $email = trim($email); //if it's got more than 255 characters bin it if ( strlen($email) > 255 ) { $valid_address = false; //any custom filters ? } elseif ( function_exists('filter_var') && defined('FILTER_VALIDATE_EMAIL') ) { $valid_address = (bool)filter_var($email, FILTER_VALIDATE_EMAIL);//<---- returns true or false } else { // you can't have more than one @ if ( substr_count( $email, '@' ) > 1 ) { $valid_address = false; } //super duper big preg_match thingy making sure no sh*te stuff in there if ( preg_match("/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i", $email) ) { $valid_address = true; } else { $valid_address = false; } } //OK, so far so good, if we have setup admin to check for the domain then run this bit if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') { //split the email address at the @ symbol $domain = explode('@', $email); //take the second part of the result and check it if ( !checkdnsrr($domain[1], "MX") && !checkdnsrr($domain[1], "A") ) { $valid_address = false; } } return $valid_address; } Each place in the function that has $valid_address = false is a point where the email can get rejected. Some place in there your server, configuration, worm hole in space etc etc is generating false as the result - you just have to work through them all to see which . Try ediing the final bit of the function by adding $valid_address = true directly above the line return $valid_address - that should make any gubbins entered into create_account work (if that fails then the error is elsewhere but I have no idea where!) if that works then your 99.9% sure that it's something in this function that is failing
MrPhil Posted September 7, 2013 Posted September 7, 2013 Can you give us a sample of a few email addresses that failed? They don't have to be real ones, but should be of the same format. Maybe the check function needs to be updated? Or maybe your copy of the function is damaged somehow? What PHP version are you running with?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.