Yii Email Validation Failed
I have an email validation, that should be work to validate email. True condition is: firstname.lastname@example.org or email@example.com or firstname.lastname@example.org Another are wrong. So I have this code on function accessrules on the model:
But when I tried to register, it said error, although I have entered the right format. This is my error
I have tried to fix it but still error. Can anyone tell me how to fix it? Thanks all
checkMX is to check the MX record for the email address. Defaults to false. To enable it, you need to make sure the PHP function 'checkdnsrr' exists in your PHP installation. Please note that this check may fail due to temporary problems even if email is deliverable.
You should put your email validation script in model rules not in accessrules of controller. try this
array("email","patern","your regex for validation","message" => "Email is not correct"),
put this array inside your model rules function array this will work for you.