samkitano/kbox

Laravel的kickbox.io电子邮件验证API的实现

v1.0.0 2015-01-23 23:13 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:44:12 UTC


README

Kickbox是PHP的电子邮件验证库

根据kickbox-php

Kickbox determines if an email address is not only valid, but associated with a actual user. Uses include:

* Preventing users from creating accounts on your applications using fake, misspelled, or throw-away email addresses.
* Reducing bounces by removing old, invalid, and low quality email addresses from your mailing lists.
* Saving money and projecting your reputation by only sending to real email users.

## Getting Started

To begin, hop over to [kickbox.io] and create a free account. Once you've signed up and logged in, click on **API Settings** and then click **Add API Key**. Take note of the generated API Key - you'll need it to setup the client as explained below.

## Bug Reports
Report [here](https://github.com/kickboxio/kickbox-php/issues).

## Need Help?
help@kickbox.io

安装

将以下内容添加到您的composer.json中

{
    "require": {
        "samkitano/kbox": "dev-master"
    }
}

更新您的依赖关系

$ php composer.phar update

打开app/config/app.php,并将新项目添加到providers数组中

'Samkitano\Kbox\KboxServiceProvider',

发布您的配置文件

php artisan config:publish samkitano/kbox

编辑app/config/packages/samkitano/kbox/config.php并提供您的API密钥

'kickbox_api_key'   => 'paste your kickbox api key here',

版本

与Laravel [ 4.2 ]兼容

使用方法

$response = Kbox::verify('email@example.com');

响应信息(来自kickbox.io)

成功的API调用将返回以下值

  • result string - 验证结果:validinvalidunknown
  • reason string - 结果的原因。可能的原因包括
    • invalid_email - 指定的电子邮件地址不是有效的电子邮件地址语法
    • invalid_domain - 电子邮件地址的域名不存在
    • rejected_email - 电子邮件地址被SMTP服务器拒绝,电子邮件地址不存在
    • accepted_email - 电子邮件地址被SMTP服务器接受
    • no_connect - 无法连接到SMTP服务器
    • timeout - SMTP会话超时
    • invalid_smtp - SMTP服务器返回了意外/无效的响应
    • unavailable_smtp - SMTP服务器无法处理我们的请求
    • unexpected_error - 发生意外错误
  • role true | false - 如果电子邮件地址是角色地址(例如postmaster@example.comsupport@example.com等),则返回true
  • free true | false - 如果电子邮件地址使用像gmail.com或yahoo.com这样的免费电子邮件服务,则返回true
  • disposable true | false - 如果电子邮件地址使用像trashmail.com或mailinator.com这样的一次性域名,则返回true
  • accept_all true | false - 如果电子邮件被接受,但该域名似乎接受发送到该域名的所有电子邮件,则返回true
  • did_you_mean null | string - 如果检测到可能的拼写错误,则返回建议的电子邮件。 (bill.lumbergh@gamil.com -> bill.lumbergh@gmail.com)
  • sendex float - 提供的电子邮件地址的质量分数,介于0(无质量)和1(完美质量)之间。有关Sendex分数的更多信息,请参阅此处
  • email string - 返回提供的电子邮件地址的标准化版本。 (BoB@example.com -> bob@example.com)
  • user string - 提供的电子邮件地址的用户(即本地部分)。 (bob@example.com -> bob)
  • domain string - 提供的电子邮件地址的域名。 (bob@example.com -> example.com)
  • success true | false - 如果API请求成功(即,没有身份验证或意外错误发生),则返回true

许可证

MIT