简体   繁体   English

Yii电子邮件验证失败

[英]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. 真实条件是:example@ext.com或dash12@ext.com或as_sa@ext.com另一个错误。 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 谢谢大家

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. 将此数组放入模型规则函数数组中将为您工作。

checkMX is to check the MX record for the email address. checkMX用于检查MX记录中的电子邮件地址。 Defaults to false. 默认为false。 To enable it, you need to make sure the PHP function 'checkdnsrr' exists in your PHP installation . 要启用它,您需要确保PHP安装中存在PHP函数'checkdnsrr' Please note that this check may fail due to temporary problems even if email is deliverable. 请注意, 即使电子邮件可以传递,由于暂时的问题 ,该检查仍可能失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM