Using curl to validate and block disposable emails
This document provides example code for how to use curl to validate an email and determine if it is from a disposable email provider using the Check-Mail API.
Check if an Email is Disposable
Use the API endpoint to determine if an email address is disposable or valid.
Example Request:
curl -X POST "https://api.check-mail.org/v2/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d "email=example@goods.email"
Replace YOUR_API_KEY with your actual API key and example@goods.email with the email address you want to validate.
Example Response:
{
"valid": true,
"block": true,
"domain": "goods.email",
"base_domain": "goods.email",
"text": "Disposable / temporary domain",
"reason": "Disposable",
"risk": 99,
"is_disposable": true,
"is_email_forwarder": false,
"is_public_free": false,
"is_public_premium": false,
"is_business_provider": false,
"is_isp_email": false,
"is_email_api": false,
"is_web_hosting_email": false,
"is_self_hosted": false,
"is_parked": false,
"is_role_based_email": false,
"mx_host": "_dc-mx.goods.email",
"mx_ip": "114.132.213.17",
"mx_info": "Using MX pointer _dc-mx.goods.email from DNS with priority: 0",
"mx_fallback": false,
"mx_hosts": [
"_dc-mx.goods.email"
],
"mx_ips": [
"114.132.213.17"
],
"mx_priorities": {
"_dc-mx.goods.email": 0
},
"email_provider": "",
"disposable_provider": "goods.email",
"possible_typo": [],
"domain_age_days": 0,
"domain_created_at": null,
"block_status_changed_at": "2024-09-16T00:39:22+00:00"
}
Explanation
- The
validfield indicates if the provided email address is in a valid format, and if the domain exists and accepts e-mails - The
blockfield indicates if we suggest you should block this e-mail or domain in your systems. - The
is_disposablefield indicates whether the email address belongs to a disposable email provider.
Next Steps
- Integrate this
curlcommand into your backend scripts to automate the detection of disposable email addresses. - Refer to the documentation for further details on the API.