zytzagoo / smtp-validate-email

A PHP library for performing email addresses validation via SMTP
GNU General Public License v3.0
446 stars 157 forks source link

Invalid e-mails verified as true #26

Closed luccaugusto closed 7 years ago

luccaugusto commented 7 years ago

i am using the code just like in the example given in the readme file, for really stupid emails like jdkflajk@jdkflajkl.com it verifies as false, as expected but for emails like x@hotmail.com it verifies as true, even though i know it is a fake email (i can look it up via another tool, Mautic, cant use to verify the email on the fly though).

zytzagoo commented 7 years ago

As far as the SMTP server is concerned, x@hotmail.com exists and can accept email:

> php test-issue-26-x-at-hotmail.com.php

[2017-10-10T07:14:52.967868+0000] MX records (hotmail.com): Array
(
    [hotmail-com.olc.protection.outlook.com] => 2
    [mx2.hotmail.com] => 5
    [mx1.hotmail.com] => 5
    [mx3.hotmail.com] => 5
    [mx4.hotmail.com] => 5
    [hotmail.com] => 0
)

[2017-10-10T07:14:52.976726+0000] Connecting to hotmail-com.olc.protection.outlook.com:25
[2017-10-10T07:14:53.196599+0000] Connected to hotmail-com.olc.protection.outlook.com:25 successfully
[2017-10-10T07:14:53.365500+0000] <<<recv: 220 BAY004-MC6F18.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.microsoft.com/en-us/anti-spam.mspx. Tue, 10 Oct 2017 00:15:25 -0700

[2017-10-10T07:14:53.369526+0000] send>>>: EHLO xxx.xx
[2017-10-10T07:14:53.537187+0000] <<<recv: 250-BAY004-MC6F18.hotmail.com (3.22.0.45) Hello [x.x.x.x]

[2017-10-10T07:14:53.538047+0000] <<<recv: 250-SIZE 36909875

[2017-10-10T07:14:53.538834+0000] <<<recv: 250-PIPELINING

[2017-10-10T07:14:53.539129+0000] <<<recv: 250-8bitmime

[2017-10-10T07:14:53.539398+0000] <<<recv: 250-BINARYMIME

[2017-10-10T07:14:53.539657+0000] <<<recv: 250-CHUNKING

[2017-10-10T07:14:53.539928+0000] <<<recv: 250-STARTTLS

[2017-10-10T07:14:53.540318+0000] <<<recv: 250-AUTH LOGIN

[2017-10-10T07:14:53.540849+0000] <<<recv: 250-AUTH=LOGIN

[2017-10-10T07:14:53.541222+0000] <<<recv: 250 OK

[2017-10-10T07:14:53.541828+0000] send>>>: MAIL FROM:<xxx@xxx.xx>
[2017-10-10T07:14:53.709246+0000] <<<recv: 250 xxx@xxx.xx....Sender OK

[2017-10-10T07:14:53.709855+0000] send>>>: NOOP
[2017-10-10T07:14:53.877632+0000] <<<recv: 250 OK

[2017-10-10T07:14:53.878698+0000] send>>>: NOOP
[2017-10-10T07:14:54.046383+0000] <<<recv: 250 OK

[2017-10-10T07:14:54.047640+0000] send>>>: RCPT TO:<x@hotmail.com>
[2017-10-10T07:14:54.261907+0000] <<<recv: 250 x@hotmail.com

[2017-10-10T07:14:54.262802+0000] send>>>: NOOP
[2017-10-10T07:14:54.430170+0000] <<<recv: 250 OK

[2017-10-10T07:14:54.431354+0000] send>>>: RSET
[2017-10-10T07:14:54.599053+0000] <<<recv: 554 Transaction failed

[2017-10-10T07:14:54.600007+0000] send>>>: QUIT
[2017-10-10T07:14:54.600851+0000] <<<recv:
[2017-10-10T07:14:54.603276+0000] No response in expect(): No response in recv
[2017-10-10T07:14:54.603667+0000] Closing socket to hotmail-com.olc.protection.outlook.com:25
array(2) {
  ["x@hotmail.com"]=>
  bool(true)
  ["domains"]=>
  array(1) {
    ["hotmail.com"]=>
    array(2) {
      ["users"]=>
      array(1) {
        [0]=>
        string(1) "x"
      }
      ["mxs"]=>
      array(6) {
        ["hotmail-com.olc.protection.outlook.com"]=>
        int(2)
        ["mx2.hotmail.com"]=>
        int(5)
        ["mx1.hotmail.com"]=>
        int(5)
        ["mx3.hotmail.com"]=>
        int(5)
        ["mx4.hotmail.com"]=>
        int(5)
        ["hotmail.com"]=>
        int(0)
      }
    }
  }
}

Also confirmed by checking some other free online validators, which all say the same thing: https://tools.verifyemailaddress.io/, http://verifalia.com/validate-email - https://hunter.io/email-verifier/x@hotmail.com classifies as risky (due to shortness etc.)

As to how/why Mautic says it doesn't exist -- it's impossible for me to know -- I have a feeling hotmail just doesn't accept any traffic from your Mautic (hosted/downloaded? who knows...) instance (for obvious reasons).

It's all about reputation when it comes to email -- see previous issues and the discussions there...

luccaugusto commented 7 years ago

Thanks. i just thought it could be something wrong in my code or something. Thank you again.