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

If no MX records found #35

Open
volgot opened this issue Feb 16, 2018 · 7 comments
Open

If no MX records found #35

volgot opened this issue Feb 16, 2018 · 7 comments

Comments

@volgot
Copy link

volgot commented Feb 16, 2018

If domain dosn't exist your script fails, hangs up and kills server
line 285
there must be "if mxQuery" ($hosts, $weights) or false (no MX servers = fake domain)
you even don't have NoMX.php in your Exceptions folder ;)
it's a good script, otherwise :)

@volgot
Copy link
Author

volgot commented Feb 16, 2018

plus, you would give 2 separate variables for HELO server and for USER
because, usually correct HELO looks like "mail.example.com" and user's email looks like "some_user@example.com" or even "some_user@example2.com" (not a "user@mail.example.com", it can be different IP also, different SPF, and it can lead to spam block some tester's IP). I just commented in setSender() //$parts = $this->splitEmail($email); to used hardcoded own:
$this->from_user = "real@user.com";
$this->from_domain = "real.mail.server";

@zytzagoo
Copy link
Owner

Hello and thanks for the feedback!

Line 285 is empty on current master: https://github.com/zytzagoo/smtp-validate-email/blob/master/src/Validator.php#L285 -- so I'm not really following what you're talking about.

The test suite is there, feel free to provide a test case that exhibits the behaviour you encounter (ideally maybe even a PR for a fix if it turns out something is really broken!).

Regarding customising the HELO sent, are you up for doing a PR for that too and allow it to be easily customised from the outside? (It should also preserve back-compat for existing users)

@volgot volgot closed this as completed Feb 16, 2018
@volgot
Copy link
Author

volgot commented Feb 16, 2018

Helo, just try to check this address: blabla@blablabla.bla
Good luck :)

@volgot
Copy link
Author

volgot commented Feb 16, 2018

or, better, this one, from real life: zzmusic@zzmusic.com (caused problem)

@volgot
Copy link
Author

volgot commented Feb 16, 2018

p.s. sorry, I made changes in code, so 285 was a wrong line number, correct, but just find a line:
list($hosts, $weights) = $this->mxQuery($domain) (it was 275)
wich must be changed to:
// Query the MX records for the current domain
list($hosts, $weights) = $this->mxQuery($domain);

        if(empty($hosts)) {
            return array($users[0]."@".$domain=>false);
        }

as a minimum, for every address in array (I check only 1 address per time, so this easy solution works for me) :)

@volgot volgot reopened this Feb 16, 2018
@volgot
Copy link
Author

volgot commented Feb 16, 2018

One more thing, checking several addresses at ones from one host (in your second example), maybe is not very good idéa, imho, it can lead to blacklist directly.. otherwise, is a very nice script, tnx for jour job :)

About HELO, everybody please check this:

The HELO string sent should in the style of:

Example:
HELO mta1.mycompany.com

The following bad example(s) will get rejected:
HELO
HELO localhost
HELO localhost.localdomain
HELO hostnameonly
HELO 192.168.1.1 (just an IP)
HELO [192.168.1.1]
HELO .com (starts with a period)
HELO fake..com
HELO @(&$ (characters not normally allowed in domain names)
Spammers will often be caught by this rule, when they take over a PC to act as a spam bot. They just use the hostname as the PC has it configured, which is normally not set up as a FQDN.

Source https://www.linuxmagic.com/best_practices/valid_helo_domain.html

Take a look at "hostnameonly" line..

p.s. valid HELO = mail.server.com (MX server which belongs to your email address)

Best regards

@Thanatermesis
Copy link

Im not sure if this is the same issue but I was validating an address that seems to be incorrect: something@archlabslinux.com , the domain exists but the MX does not, and seems like smtp-validate-email returns a FALSE positive for connecting to an invalid MX server (which says 0.0.0.0), see the logs:

array (
  0 => '[2021-04-14T01:34:03.948473+0000] MX records (archlabslinux.com): Array
(
    [0.0.0.0] => 1000
    [archlabslinux.com] => 0
)
',
  1 => '[2021-04-14T01:34:03.948533+0000] Connecting to 0.0.0.0:25',
  2 => '[2021-04-14T01:34:03.948692+0000] Connected to 0.0.0.0:25 successfully',
  3 => '[2021-04-14T01:34:03.956457+0000] << '[2021-04-14T01:34:03.956587+0000] send>>>: EHLO mydomain.com...
etc... ending in a valid verification

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

No branches or pull requests

3 participants