@abstractapi/javascript-email-validation 中文文档教程

发布于 3年前 浏览 18 项目主页 更新于 3年前

AbstractAPI javascript-email-validation library

通过几行代码将功能强大的 来自 Abstract 的电子邮件验证 API 集成到您的 Javascript 或 NodeJS 项目中。

Abstract 的 Email Validation and Verification API 是一种快速、轻量级、现代且 RESTful 的 JSON API,用于确定电子邮件地址的有效性和其他详细信息。

使用起来非常简单:您只需提交您的 API 密钥和一个电子邮件地址,API 将响应对其有效性的评估,以及其他详细信息,例如质量得分(如果是一次性电子邮件)、一个通用地址等.

验证和验证电子邮件地址是减少网站或应用程序中出现低质量数据和欺诈或风险用户的机会的关键步骤。

Documentation

Installation

您可以从我们的 CDN 通过 npm 安装 javascript-email-validation,或者将源代码下载到您的项目中。

ES6

从 npm 下载并安装库:

npm install @abstractapi/javascript-email-validation --save

在你的项目中,导入它并配置你的 API_KEY

import {AbstractEmailValidation} from 'javascript-email-validation'

AbstractEmailValidation.configure('API_KEY')

Browser, from the CDN

你可以让浏览器通过 jsDeliver CDN 从最近的位置下载库:

<script src="https://cdn.jsdelivr.net/npm/@abstractapi/javascript-core@latest/dist/javascript-core.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@abstractapi/javascript-email-validation@latest/dist/javascript-email-validation.js"></script>
<script>
    AbstractEmailValidation.configure('API_KEY');

    // use the library
</script>

Browser, from the built file

你可以自己构建库,或者从 dist 目录获取已经构建的文件并加载它:

<script src="dist/javascript-email-validation.js"></script>
<script>
    AbstractEmailValidation.configure('API_KEY');

    // use the library
</script>

API key

抽象网站

Quickstart

AbstractAPI javascript-email-validation 库返回一个 Promise< /a> 因此您可以使用以下方法之一:

Async/Await

async function validateEmail(email) {
  let response = await AbstractEmailValidation.verify(email);
  console.log(response);
}

Using .then()

function validateEmail(email) {
  AbstractEmailValidation.verify(email)
    .then(response => {
      console.log(response);
    })
}

API response

API 响应包含以下字段:

| 参数 | 类型 | 详情 | | - | - | - | | 电邮 | 字符串 | 输入到请求中的“电子邮件”值。 | | 自动更正 | 字符串 | 如果检测到拼写错误,则此参数返回正确电子邮件的建议(例如,johnsmith@gmial.com => johnsmith@gmail.com)。 如果没有检测到拼写错误,那么这是空的。 | | 送达率 | 字符串 | 摘要对电子邮件的可传递性的评估。 可能的值有:DELIVERABLE、UNDELIVERABLE、RISKY 和 UNKNOWN | | 质量得分 | 编号 | 介于 0.01 和 0.99 之间的内部小数分数反映了 Abstract 对所提交电子邮件的质量和可传递性的信心。 | | 是有效格式 | 布尔值 | 如果电子邮件遵循“地址@域.TLD”的格式,则为真。 如果这些元素中的任何一个缺失或者它们包含额外的或不正确的特殊字符,则返回 false。 | | 免费电子邮件 | 布尔值 | 如果在 Abstract 的免费电子邮件提供商列表(例如 Gmail、Yahoo 等)中找到电子邮件的域,则为真。 | | 是一次性电子邮件 | 布尔值 | 如果在 Abstract 的一次性电子邮件提供商列表(例如,Mailinator、Yopmail 等)中找到电子邮件的域,则为真。 | | 是角色电子邮件 | 布尔值 | 如果电子邮件的本地部分(例如,“收件人”部分)似乎是针对角色而不是个人,则为真。 这方面的示例包括“team@”、“sales@”、info@ 等。 | 是包罗万象电子邮件 | 布尔值 | 如果域配置为捕获所有电子邮件,则为真。 | | 找到mx | 布尔值 | 如果可以找到域的 MX 记录,则为真。 仅适用于付费计划。 将在免费计划中返回 null 和 UNKNOWN。 | | 是smtp有效 | 布尔值 | 为真表示域的 SMTP 检查成功。 仅适用于付费计划。 将在免费计划中返回 null 和 UNKNOWN。 |

Detailed documentation

您可以在 Abstract 帮助页面 中找到更多信息和请求示例。

Getting help

如果您在安装或使用库方面需要帮助,请联系 Abstract 的支持

对于错误报告和功能建议,请使用此存储库问题页面

Contribution

贡献总是受欢迎的,因为它们提高了我们提供给社区的图书馆的质量。

请提供相应单元测试涵盖的更改,并将它们发布到拉取请求页面

NPM

Installation

在命令行中运行 npm install 以安装依赖项。 要更新这些依赖项,您需要运行 npm update

Building

要构建库并在 dist 目录中生成缩小文件,您需要运行 npm run build

要构建库,您需要运行 npm run build:lib

Test

要运行测试套件,您需要运行:npm run test

AbstractAPI javascript-email-validation library

Integrate the powerful email validation API from Abstract in your Javascript or NodeJS project in a few lines of code.

Abstract's Email Validation and Verification API is a fast, lightweight, modern, and RESTful JSON API for determining the validity and other details of email addresses.

It's very simple to use: you only need to submit your API key and an email address, and the API will respond an assessment of its validity, as well as additional details like quality score if it's a disposable email, a catchall address, and more.

Validating and verifying email addresses is a critical step to reducing the chances of low-quality data and fraudulent or risky users in your website or application.

Documentation

Installation

You can install javascript-email-validation via npm, from our CDN, or download the source into your project.

ES6

Download and install the library from npm:

npm install @abstractapi/javascript-email-validation --save

In your project, import it and configure your API_KEY:

import {AbstractEmailValidation} from 'javascript-email-validation'

AbstractEmailValidation.configure('API_KEY')

Browser, from the CDN

You can have the browser download the library from its closest location through jsDeliver CDN:

<script src="https://cdn.jsdelivr.net/npm/@abstractapi/javascript-core@latest/dist/javascript-core.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@abstractapi/javascript-email-validation@latest/dist/javascript-email-validation.js"></script>
<script>
    AbstractEmailValidation.configure('API_KEY');

    // use the library
</script>

Browser, from the built file

You can build the library yourself, or get the already built file from the dist directory and load it:

<script src="dist/javascript-email-validation.js"></script>
<script>
    AbstractEmailValidation.configure('API_KEY');

    // use the library
</script>

API key

Get your API key for free and without hassle from the Abstact website.

Quickstart

AbstractAPI javascript-email-validation library returns a Promise so you can use one of the following approaches:

Async/Await

async function validateEmail(email) {
  let response = await AbstractEmailValidation.verify(email);
  console.log(response);
}

Using .then()

function validateEmail(email) {
  AbstractEmailValidation.verify(email)
    .then(response => {
      console.log(response);
    })
}

API response

The API response contains the following fields:

| PARAMETER | TYPE | DETAILS | | - | - | - | | email | String | The value for "email" that was entered into the request. | | autocorrect | String | If a typo has been detected then this parameter returns a suggestion of the correct email (e.g., johnsmith@gmial.com => johnsmith@gmail.com). If no typo is detected then this is empty. | | deliverability | String | Abstract's evaluation of the deliverability of the email. Possible values are: DELIVERABLE, UNDELIVERABLE, RISKY, and UNKNOWN | | qualityscore | Number | An internal decimal score between 0.01 and 0.99 reflecting Abstract's confidence in the quality and deliverability of the submitted email. | | isvalidformat | Boolean | Is true if the email follows the format of "address @ domain . TLD". If any of those elements are missing or if they contain extra or incorrect special characters, then it returns false. | | isfreeemail | Boolean | Is true if the email's domain is found among Abstract's list of free email providers (e.g., Gmail, Yahoo, etc). | | isdisposableemail | Boolean | Is true if the email's domain is found among Abstract's list of disposable email providers (e.g., Mailinator, Yopmail, etc). | | isroleemail | Boolean | Is true if the email's local part (e.g., the "to" part) appears to be for a role rather than individual. Examples of this include "team@", "sales@", info@", etc. | | iscatchallemail | Boolean | Is true if the domain is configured to catch all email. | | ismxfound | Boolean | Is true if MX Records for the domain can be found. Only available on paid plans. Will return null and UNKNOWN on free plans. | | issmtpvalid | Boolean | Is true is the SMTP check of the domain was successful. Only available on paid plans. Will return null and UNKNOWN on free plans. |

Detailed documentation

You will find additional information and request examples in the Abstract help page.

Getting help

If you need help installing or using the library, please contact Abstract's Support.

For bug report and feature suggestion, please use this repository issues page.

Contribution

Contributions are always welcome, as they improve the quality of the libraries we provide to the community.

Please provide your changes covered by the appropriate unit tests, and post them in the pull requests page.

NPM

Installation

Run npm install in the command line to install the dependencies. To update those dependencies you need to run npm update.

Building

To build the library and generate the minified file in the dist directory, you need to run npm run build.

To build the lib, you need to run npm run build:lib.

Test

To run the test suite, you need to run: npm run test.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文