MattKetmo/EmailChecker

Not working

Closed this issue · 6 comments

The following code is returning true in both cases:

<?php

require __DIR__.'/vendor/autoload.php';

use EmailChecker\EmailChecker;

$checker = new EmailChecker();

echo $checker->isValid('foo@bar.org')? 'true': 'false';     // true
echo $checker->isValid('foo@yopmail.com')? 'true': 'false'; // false
exit();

hum, that's not what I get :)

➜ composer require "mattketmo/email-checker:~0.1"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing mattketmo/email-checker (v0.2)
    Downloading: 100%

mattketmo/email-checker suggests installing symfony/validator (Add validation constraints)
mattketmo/email-checker suggests installing knplabs/gaufrette (Use filesystem abstraction layer to read data)
Writing lock file
Generating autoload files

➜ cat example.php
<?php

require __DIR__.'/vendor/autoload.php';

use EmailChecker\EmailChecker;

$checker = new EmailChecker();

echo $checker->isValid('foo@bar.org')? 'true': 'false';     // true
echo PHP_EOL;
echo $checker->isValid('foo@yopmail.com')? 'true': 'false'; // false
exit();

➜ php example.php
true
false

The default adapter is checking email domains from file vendor/mattketmo/email-checker/res/throwaway_domains.txt (source).

Can you ensure me you have this file? (Did you install the lib via composer?)

Yes I have that file in that exact location. Yes I did install the lib via composer. I am running PHP 5.4.7. Do you think that makes a difference?

That's weird, it should pass for any php version >= 5.3.

What do you have with this:

➜ echo barbaz.org > domains.txt
➜ cat example.php
<?php

require __DIR__.'/vendor/autoload.php';

use EmailChecker\EmailChecker;
use EmailChecker\Adapter\FileAdapter;

$checker = new EmailChecker(new FileAdapter(__DIR__.'/domains.txt'));

echo $checker->isValid('foo@barbaz.org')? 'true': 'false';
echo PHP_EOL;
echo $checker->isValid('foo@foobar.net')? 'true': 'false';

➜ php example.php
false
true

?

Btw, on which OS do you run?

I am getting
false
true
...for this one.
I am running Win 7 with XAMPP 1.8.1 (Apache 2.4.3)

Hi, did you finally understand why this was not working on Windows? — I haven't any Windows here to reproduce the issue.

If not, can you:

  • show the md5 sum of res/throwaway_domains.txt (current one is c5ee9bf89a20a7f2316178123e1916cf)
  • replace PHP_EOL by "\n" on src/EmailChecker/Utilities.php line 54 and test again

Thanks.