Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email dns validation passes if domain has no mx record #34092

Closed
tpetry opened this issue Sep 2, 2020 · 4 comments
Closed

Email dns validation passes if domain has no mx record #34092

tpetry opened this issue Sep 2, 2020 · 4 comments

Comments

@tpetry
Copy link
Contributor

tpetry commented Sep 2, 2020

  • Laravel Version: 7.27.0
  • PHP Version: 7.4.9

Description:

The email dns validation passes emails as correct even if they have no mx record and you really can't send a mail to the domain.

Steps To Reproduce:

$v = \Illuminate\Support\Facades\Validator::make([
    'email' => 'xxx@icluod.com', // transposed characters 'o' and 'u'
], [
    'email' => 'email:dns',
]);
dd($v->passes());

Reason for the Result:

Laravel is using DNSCheckValidation of egulias/email-validator. But their implementation is a little bit tricky:

The provided domain passes the dns validation because the domain has an A record but a warning is saved that no mx-record was found. So laravel would have to correctly fail the email:dns validation if this warning is present as the email recipient is not reachable. At the moment it's just looking at the boolean return value.

@driesvints
Copy link
Member

I don't think a warning is a valid reason to fail this rule. We depend on the boolean return.

@tpetry
Copy link
Contributor Author

tpetry commented Sep 2, 2020

@driesvints @taylorotwell What is the intended use case for the dns validation? The laravel documentation does not state what the dns validation should do. But with the actual implementation the dns check does not verify that the host has mx dns records so the recipient is reachable. Unreachable hosts pass the validation.

@driesvints
Copy link
Member

@tpetry it's best to reference the docs for the underlying email validator library for that.

@iosty
Copy link

iosty commented Jun 7, 2022

indique le répertoire à suivre je ne sais pas ou est ce que je doit effectuer la modification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants