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 GET "https://api.check-mail.org/v1/?email=example@goods.email" \
-H "Authorization: Bearer YOUR_API_KEY"
Replace YOUR_API_KEY
with your actual API key and example@mail.com
with the email address you want to validate.
Example Response:
{
"valid": true,
"block": true,
"disposable": true,
"domain": "goods.email",
"text": "Disposable / temporary domain",
"reason": "Disposable",
"risk": 99,
"mx_host": "_dc-mx.goods.email",
"possible_typo": [],
"mx_ip": "114.132.213.17",
"mx_info": "Using MX pointer _dc-mx.goods.email from DNS with priority: 0",
"last_changed_at": "2024-09-16T00:39:22+02:00"
}
Explanation
- The
valid
field indicates if the provided email address is in a valid format, and if the domain exists and accepts e-mails - The
block
field indicates if we suggest you should block this e-mail or domain in your systems. - The
disposable
field indicates whether the email address belongs to a disposable email provider.
Next Steps
- Integrate this
curl
command into your backend scripts to automate the detection of disposable email addresses. - Refer to the documentation for further details on the API.