Laravel email validation quality This results make me wondering. Why is test@test validated as a correct email adress?
$validator = Validator::make(['visitorEmail' => "[email protected] "], [
'visitorEmail' => 'email',
]);
if ($validator->fails()) {
dd('wrong format');
} else {
dd('correct format');
}
Test:
[email protected] => correct format
test@@test.com => wrong format
test@test => correct format
33test@test33 => correct format
[email protected] => correct format
Its because email just validates whether the given information a valid email format or not. It doesn't check whether the email address is exists or not.
So, here a valid email can be any string before and after the @ symbol.
For example-
test@test
or
[email protected]
But when you provide test@@test.com it will return false because in an email format it cannot have two 2 symbols.
Please sign in or create an account to participate in this conversation.