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

Should domains with "void.blackhole.mx." be considered valid ? #384

Open
williamdes opened this issue May 1, 2024 · 3 comments
Open

Should domains with "void.blackhole.mx." be considered valid ? #384

williamdes opened this issue May 1, 2024 · 3 comments

Comments

@williamdes
Copy link

https://bornoe.org/blog/2016/05/fighting-spam-with-fake-mx-records/

Example domain: wdes.ru

@williamdes
Copy link
Author

diff --git a/app/Validator/DNSCheckValidation.php b/app/Validator/DNSCheckValidation.php
index a94f30fd8..a3f181a12 100644
--- a/app/Validator/DNSCheckValidation.php
+++ b/app/Validator/DNSCheckValidation.php
@@ -39,6 +39,18 @@ class DNSCheckValidation implements EmailValidation
         'lan',
     ];
 
+    /**
+     * @see https://bornoe.org/blog/2016/05/fighting-spam-with-fake-mx-records/
+     */
+    public const INVALID_MX_VALUES = [
+        'tar.junkemailfilter.com',
+        'mx.fakemx.net',
+        'in.verboten.net',
+        'void.blackhole.mx',
+        // "Null MX" record indicates the domain accepts no mail (https://tools.ietf.org/html/rfc7505)
+        '.',
+    ];
+
     public const GOOD_DOMAINS = [
         'free.fr',
         'sfr.fr',
@@ -651,7 +663,7 @@ class DNSCheckValidation implements EmailValidation
         }
 
         // "Null MX" record indicates the domain accepts no mail (https://tools.ietf.org/html/rfc7505)
-        if (empty($dnsRecord['target']) || $dnsRecord['target'] === '.') {
+        if (empty($dnsRecord['target']) || in_array($dnsRecord['target'], self::INVALID_MX_VALUES)) {
             $this->error = new InvalidEmail(new DomainAcceptsNoMail(), "");
             return false;
         }

@egulias
Copy link
Owner

egulias commented May 1, 2024

Hi @williamdes
The objective of this library is to check whether the email is semantically valid against the various RFCs.
The DNS validations is on the limits of that mission, as it goes to the internet to check for MX records.
I'd also argue that for this to be useful a comprehensive list should be maintained, either retrieving it from some source or keeping it up to date.

Given the above and answering your question, the domain is syntactically valid. A different matter is if you want to filter out some domains based on other rules.

In case you want to add these rules to the validation process of the validator, you always can by implementing the interface.
Cheers!

@williamdes
Copy link
Author

Hi @egulias
Thank you for this reply.

Would you then accept to integrate into this repo validators for:

There is currently no repo or google search else than the blog post linked above that lists such services. GitHub code search did find nothing.

/cc @smeinecke

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

2 participants