peoplefone/mail-validator-mx-server
Composer 安装命令:
composer require peoplefone/mail-validator-mx-server
包简介
Validate e-mail addresses by connecting to the remote MX server.
关键字:
README 文档
README
This package allows you to define e-mail addresses to verify them via the corresponding remote MX server.
The validation returns an array of objects containing:
- E-mail address
- MX domain(s)
- MX response code
- MX response message
Installation
composer require peoplefone/mail-validator-mx-server
How it works
These are the requests and responses with the remote MX server.
telnet mx.domain.com 25
Trying 66.96.140.73...
Connected to mx.domain.com.
Escape character is '^]'.
220 bosimpinc12 bizsmtp ESMTP server ready
helo mydomain.com 250 bosimpinc12 hello [95.128.x.x], pleased to meet you
MAIL FROM: <me@mydomain.com> 250 <me@mydomain.com> sender ok
RCPT TO: <test@domain.com> 250 <test@domain.com> recipient ok
quit 221 bosimpinc12 bizsmtp closing connection
Example
Basic Usage
require("vendor/autoload.php"); use peoplefone\mailValidatorMXServer; $class = new mailValidatorMXServer("mydomain.com", "me@mydomain.com"); $class->setContact("noreply@hotmail.com"); $class->setContact("noreply@gmail.com"); $class->setContact("noreply@yahoo.com"); $result = $class->validate(); print_r($result);
Result
The returned codes correspond to the RFC5321.
https://tools.ietf.org/html/rfc5321
For ordinary use, it can be assumed that the e-mail address is valid when code 250 is returned.
Array
(
[0] => stdClass Object
(
[mail] => noreply@gmail.com
[host] => Array
(
[0] => gmail-smtp-in.l.google.com
[1] => alt1.gmail-smtp-in.l.google.com
[2] => alt2.gmail-smtp-in.l.google.com
[3] => alt3.gmail-smtp-in.l.google.com
[4] => alt4.gmail-smtp-in.l.google.com
)
[code] => 550
[text] => Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)
)
[1] => stdClass Object
(
[mail] => noreply@hotmail.com
[host] => Array
(
[0] => hotmail-com.olc.protection.outlook.com
)
[code] => 250
[text] => Requested mail action okay, completed
)
[2] => stdClass Object
(
[mail] => noreply@yahoo.com
[host] => Array
(
[0] => mta7.am0.yahoodns.net
[1] => mta6.am0.yahoodns.net
[2] => mta5.am0.yahoodns.net
)
[code] => 250
[text] => Requested mail action okay, completed
)
)
Settings Functions
/** * Port of the remove MX Server. */ $class->setConnectionPort("25"); /** * Timeout of each connection. */ $class->setConnectionTimeOut("30"); /** * Timeout of each communication. * Note that some MX servers are configured to wait before responding or respond with multiple lines. * Perhaps you need to increase the stream timeout to get successful validation. */ $class->setStreamTimeOut("15"); /** * Pass the Boolean value TRUE to print the debug log. */ $class->validate(true);
Contact Functions
$class->setContact("noreply@gmail.com"); $class->unsetContact("noreply@gmail.com"); $class->getContacts()
peoplefone/mail-validator-mx-server 适用场景与选型建议
peoplefone/mail-validator-mx-server 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mail」 「validator」 「check」 「smtp」 「MX」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 peoplefone/mail-validator-mx-server 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 peoplefone/mail-validator-mx-server 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 peoplefone/mail-validator-mx-server 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
Runn Me! Validation and Sanitization Library
Extension for Opis JSON Schema
This Extension integrates a credit check and more made by the LEONEX Risk Management Platform into your order process. Extensive configuration and evaluation options is provided in the Platform
SoftWax Health Check Bundle for Symfony framework
Check for holidays - localeaware
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-26