定制 flow/email-checker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flow/email-checker

Composer 安装命令:

composer require flow/email-checker

包简介

Check if email addresses exist on a mail server over SMTP using ReactPHP's famous non-blocking event loop

README 文档

README

EmailChecker connects to mail servers over SMTP and asks them to verify email addresses. The library uses ReactPHP's event-driven IO layer to handle all the socket communication.

Key features:

  • N connections are opened concurrently and handled asyncronously thanks to ReactPHP.
  • Connections are pooled and kept alive so that multiple requests to the same domain are handled efficiently.

Caveats:

  • SMTP servers respond with any old random response and can't be trusted especially when requesting a mailbox's RCPT (though this approach is better than nothing).
  • MX records are resolved using getmxrr() and therefore that operation is blocking.

To do:

  • Implement React/DNS when is supports MX record resolution.
  • Unit test all of the things.

Example:

use Flow\EmailChecker\ConnectionPool;
use Flow\EmailChecker\MailboxUser;

$loop = React\EventLoop\Factory::create();

$emails = array(
    'stephen@flowsa.com',
    'i-dont-exist-asdf-1234@gmail.com'
);

$connectionPool = new ConnectionPool($loop, 'flowsa.com', 'stephen', function (ConnectionPool $pool) use (& $emails) {
    $email = array_shift($emails);

    if (!$email) {
        return false; // Returning false will cause the connection pool to drain and eventually die
    }

    $pool->add(
        $email,
        function (MailboxUser $email) { // Bind in a closure for the callback that occurs after an email is resolved
            echo $email->getEmail() . ($email->exists() ? ' exists' : ' does not exist') . "\n";
        }
    );

}, function ($str) {
    echo "$str\n";
});

$connectionPool->setConcurrency(10);
$connectionPool->run();

统计信息

  • 总下载量: 542
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固