邮箱验证API
为了提高客户数据质量 ,新录入的联系人信息在直接输入 时就验证其有效性至关重要。我们的电子邮件在线检测API 能将自动检测邮件地址直接从现有表单中嵌入网页内,并能立即检测出输入错误,同时仅接受有效的邮件地址。
注册申请一个 免费的API密钥,试用我们的服务。
如何通过API检测邮件地址?
我们的 邮件地址验证API 可以轻松嵌入现有网站或者应用程序(包括网站内容管理及发布系统,如Drupal,Typo3, WordPress或者Joomla)的Javascript、PHP、Java、C#、VB和NET-Code内。作为结果,API将反馈 每一个邮件地址的可投递性状态。
我们的多级验证程序可以为您完整检测每一个邮件地址并包含以下所有检测:
- 语法验证 (根据当前的IETF/RFC标准)
- DNS验证,包含MX记录检测
- 识别临时 一次性邮件地址
- 识别拼写错误的域名以防止 误植域名
- SMTP连接检测
- SMTP临时性错误检测
- 收件人邮箱存在状态检查
- Catch-All检测
- 灰名单检测
我们保证,在整个检测过程中,我们绝不会向收件人邮箱发送任何一封邮件。
WordPress,jQuery,Node.js插件
为在 WordPress,jQuery或者Node.js 中使用API,现已现已有完整插件可供安装:
API嵌入:代码示例
- API描述
- jQuery
- PHP
- Java
- C#
- VB.NET
Real-Time Email Verification API
API URL | http[s]://api.email-validator.net/api/verify |
Method | GET or POST |
Example API request (using the GET method): | |
https://api.email-validator.net/api/verify?EmailAddress=support@byteplant.com&APIKey=your API key | |
Input Parameters | |
EmailAddress (string) | email address to validate |
APIKey (string) | your API key |
Timeout (int) | timeout in seconds (default 10s, min 5s, max 300s) |
API Result (JSON) | |
status (int) | API result code |
'401', '118' and '119' status codes indicate API errors:
'401' -> info: 'Email address missing' '118' -> info: 'Rate Limit Exceeded' '119' -> info: 'API Key Invalid or Depleted' |
|
info (string) | short status description |
details (string) | full status description |
freemail (boolean) | indicates freemail addresses (Gmail, Yahoo, Outlook/Hotmail/Live, AOL, ...) [true | false] |
ratelimit_remain (int) | number of API requests remaining before the API rate limit is reached (the default API rate limit allows 100 API requests in 300s) |
ratelimit_seconds (int) | number of seconds remaining in the current rate limit interval |
Bulk Email Validation API
The Bulk API allows you to upload up to 100K email addresses for validation with a single API request.
API URL | http[s]://bulk.email-validator.net/api/verify |
Method | POST |
Input Parameters | |
EmailAddress (string) | list of email addresses to validate (separated by '\n') |
APIKey (string) | your API key |
TaskName (string) | name for this validation task [optional] |
ValidationMode (string) | express (retries unavailable servers for 2 hours) or extensive (retries unavailable servers for 72 hours) |
NotifyEmail (string) | email address to receive notifications for this task [optional, default is the email address of the API account] |
NotifyURL (string) | URL to receive a completion notification for this task [optional] |
API Result (JSON) | |
status (int) | API result code (121 or 119) |
info (string) | validation task id (if status is 121/"Task Accepted") |
Email Validation with jQuery
<script type="text/javascript" src="path/to/jquery"></script> <script type="text/javascript"> $(document).ready(function() { ... // send API request $.ajax({ url: 'https://api.email-validator.net/api/verify', type: 'POST', cache: false, crossDomain: true, data: { EmailAddress: 'email address', APIKey: 'your API key' }, dataType: 'json', success: function (json) { // check API result if (typeof(json.status) != "undefined") { var resultcode = json.status; if (typeof(json.info) != "undefined") { // short summary info = json.info; } else info = ""; if (typeof(json.details) != "undefined") { // detailed description details = json.details; } else details = ""; // resultcode 200, 207, 215 - valid // resultcode 215 - can be retried to update catch-all status // resultcode 114 - greylisting, wait 5min and retry // resultcode 118 - api rate limit, wait 5min and retry // resultcode 3xx/4xx - bad } } }); }); </script>
Email Validation API with PHP
// build API request $APIUrl = 'https://api.email-validator.net/api/verify'; $Params = array('EmailAddress' => 'email address', 'APIKey' => 'your API key'); $Request = http_build_query($Params, '', '&'); $ctxData = array( 'method'=>"POST", 'header'=>"Connection: close\r\n". "Content-Type: application/x-www-form-urlencoded\r\n". "Content-Length: ".strlen($Request)."\r\n", 'content'=>$Request); $ctx = stream_context_create(array('http' => $ctxData)); // send API request $result = json_decode(file_get_contents($APIUrl, false, $ctx)); // check API result if ($result && $result->{'status'} > 0) { switch ($result->{'status'}) { // valid addresses have a {200, 207, 215} result code // result codes 114 and 118 need a retry case 200: case 207: case 215: echo "Address is valid."; // 215 - can be retried to update catch-all status break; case 114: // greylisting, wait 5min and retry break; case 118: // api rate limit, wait 5min and retry break; default: echo "Address is invalid."; echo $result->{'info'}; echo $result->{'details'}; break; } } else { echo $result->{'info'}; }
Email Address Validation with Java
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; HttpClient client = new DefaultHttpClient(); String Email = "email address"; String APIKey = "your API key"; String APIURL = "https://api.email-validator.net/api/verify"; try { HttpPost request = new HttpPost(APIURL); List <NameValuePair> Input = new ArrayList<NameValuePair>(); Input.add(new BasicNameValuePair("EmailAddress", Email)); Input.add(new BasicNameValuePair("APIKey", APIKey)); request.setEntity(new UrlEncodedFormEntity(Input)); HttpResponse response = client.execute(request); HttpEntity entity = response.getEntity(); String Output = EntityUtils.toString(entity, "UTF-8"); JSONParser parser = new JSONParser(); Object obj = parser.parse(Output); JSONObject jsonObject = (JSONObject) obj; Long result = (Long) jsonObject.get("status"); // result 200, 207, 215 - valid // result 215 - can be retried to update catch-all status // result 114 - greylisting, wait 5min and retry // result 118 - api rate limit, wait 5min and retry // result 3xx/4xx - bad String info = (String) jsonObject.get("info"); String details = (String) jsonObject.get("details"); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } finally { client.getConnectionManager().shutdown(); }
Email-Validator with C#
using System; using System.Collections.Generic; using System.Net.Http; private class APIResult { public int status { get; set; } public String info { get; set; } public String details { get; set; } } const String APIURL = "https://api.email-validator.net/api/verify"; HttpClient client = new HttpClient(); String Email = "email address"; String APIKey = "your API key"; var postData = new List<KeyValuePair<string, string>>(); postData.Add(new KeyValuePair<string, string>("EmailAddress", Email)); postData.Add(new KeyValuePair<string, string>("APIKey", APIKey)); HttpContent content = new FormUrlEncodedContent(postData); HttpResponseMessage result = client.PostAsync(APIURL, content).Result; string resultContent = result.Content.ReadAsStringAsync().Result; APIResult res = new System.Web.Script.Serialization.JavaScriptSerializer(). Deserialize<APIResult>(resultContent); switch (res.status) { // valid addresses have a {200, 207, 215} result code // result codes 114 and 118 need a retry case 200: case 207: case 215: // address is valid // 215 - can be retried to update catch-all status break; case 114: // greylisting, wait 5min and retry break; case 118: // api rate limit, wait 5min and retry break; default: // address is invalid // res.info // res.details break; }
Email-Validator API with VB.NET
Private Sub checkEmail(ByVal Email As String, ByVal APIKey As String) Const APIURL As String = "https://api.email-validator.net/api/verify" Using client As New Net.WebClient Dim postData As New Specialized.NameValueCollection postData.Add("EmailAddress", Email) postData.Add("APIKey", APIKey) Dim reply = client.UploadValues(APIURL, "POST", postData) Dim data As String = (New System.Text.UTF8Encoding).GetString(reply) Dim res = New System.Web.Script.Serialization.JavaScriptSerializer(). Deserialize(Of APIResult)(data) Select Case (res.status) Case 200, 207, 215 ' address is valid ' 215 - can be retried to update catch-all status Case 114, 118 ' greylisting, wait 5min and retry Case 118 ' api rate limit, wait 5min and retry Case Else ' address is invalid End Select End Using End Sub Private Class APIResult Public status As Integer Public info As String Public details As String End Class
邮箱验证API:免费试用
试用我们的 电子邮件在线检测API ,您可以检测最多1000个邮件地址——在此注册,获取 免费的API密钥!