Yii Email Validation Failed

I have an email validation, that should be work to validate email. True condition is: example@ext.com or dash12@ext.com or as_sa@ext.com 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

Answers


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.


Need Your Help

CodeIgniter - database result array but only one row

php database arrays codeigniter row

I'm looking for a way to return an array from the database query, but only for the first row. I'd prefer not to use objects..

XSL FO inline alignment

pdf xsl-fo

I need to get text aligned right and left on the same line. This should be possible, but i can't seem to find a way. I'm using Apache FOP to convert xml to pdf.