Problem with valid_email return true for invalid email address |
Hello,
I'm new to CI and just setup and working on the sign up form, but some how the valid_email rule in form validation is not working. I have tried the function valid_email() too and it's still not working. How come this email "a!b#c$e%g^h&j*[email protected]" can pass the validation? PHP Code: <?php This code is displaying "valid email". Did I miss something? Please help.
Because it's valid (and don't know that gmail have restrictions):
https://en.wikipedia.org/wiki/Email_address#Examples
So if I want to reject that email, then I guess I have to create my own rules.
Thanks jreklund.
You should be using the PHP Filters.
PHP Code: $email = "[email protected]"; What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-17-2018, 03:16 PM)zjonsnowz Wrote: So if I want to reject that email, then I guess I have to create my own rules. That's correct. According to the standard it's valid, but I haven't seen any human include those signs... So you can also check for symbols and deny those e-email addresses. @InsiteFX: That's exactly what that function does.
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo("$email is a valid email address"); } else { echo("$email is not a valid email address"); } |
Welcome Guest, Not a member yet? Register Sign In |