madeitbelgium/verifyemail
Composer 安装命令:
composer require madeitbelgium/verifyemail
包简介
PHP Laravel class to verify an email address and make sure it is valid and does exist on the mail server.
README 文档
README
Is a PHP class to verify an email address and make sure it is valid and does exist on the mail server.
This class connects to the mail server and checks whether the mailbox exists or not.
Installation
Require this package in your composer.json and update composer.
"madeitbelgium/verifyemail": "~1.0"
Publish the config file. Set the correct email address.
php artisan vendor:publish
Documentation
Usage
use MadeITBelgium\VerifyEmail\Facades\VerifyEmail; $ve = VerifyEmail::verify('some.email.address@example.com');
OR (You can set another second email address or change the port)
$ve = VerifyEmail::verify('some.email.address@example.com', 'my.email.address@my-domain.com', 26);
This will return a boolean. True if the email is valid, false otherwise.
The first email address 'some.email.address@example.com' is the one to be checked, and the second 'my.email.address@my-domain.com' is an email address to be provided to the server. This email needs to be valid and from the same server that the script is running from. To make sure your server is not treated as a spam or gets blacklisted check the score of your server here https://mail-tester.com
If you want to get any errors, call this function after the verify function:
print_r(VerifyEmail::getErrors());
This will return an array of all errors (if any):
Array
(
[0] => No suitable MX records found.
)
If you want to get all debug messages of the connection, call this function:
print_r(VerifyEmail::getDebug());
This will return an array of all messages and values that used during the process.
Array
(
[0] => initialized with Email: h*****@gmail.com, Verifier Email: sam@verifye.ml, Port: 25
[1] => Verify function was called.
[2] => Finding MX record...
[3] => Found MX: alt4.gmail-smtp-in.l.google.com
[4] => Connecting to the server...
[5] => Connection to server was successful.
[6] => Starting veriffication...
[7] => Got a 220 response. Sending HELO...
[8] => Response: 250 mx.google.com at your service
[9] => Sending MAIL FROM...
[10] => Response: 250 2.1.0 OK gw8si3985770wjb.84 - gsmtp
[11] => Sending RCPT TO...
[12] => Response: 250 2.1.5 OK gw8si3985770wjb.84 - gsmtp
[13] => Sending QUIT...
[14] => Looking for 250 response...
[15] => Found! Email is valid.
)
And to see the raw debug messages of the server commands sent
print_r(VerifyEmail::getDebug(true));
which will return an array:
Array
(
[helo] => 250 mx.google.com at your service
[mail_from] => 250 2.1.0 OK a68si4170774ioe.18 - gsmtp
[rcpt_to] => 250 2.1.5 OK a68si4170774ioe.18 - gsmtp
[quit] => 4
)
Notes:
-
Some mail servers will silently reject the test message, to prevent spammers from checking against their users' emails and filter the valid emails, so this function might not work properly with all mail servers.
-
You server must be configured properly as a mail server to avoid being blocked or blacklisted. This includes things like SSL, SPF records, Domain Keys, DMARC records, etc. To check your server use this tool https://mail-tester.com
Support
Support github or mail: tjebbe.lievens@madeit.be
Contributing
Please try to follow the psr-2 coding style guide. http://www.php-fig.org/psr/psr-2/
License
This package is licensed under LGPL. You are free to use it in personal and commercial projects. The code can be forked and modified, but the original copyright author should always be included!
madeitbelgium/verifyemail 适用场景与选型建议
madeitbelgium/verifyemail 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 madeitbelgium/verifyemail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 madeitbelgium/verifyemail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2020-07-26