DEV Community

Milos Ilic
Milos Ilic

Posted on

How to Validate Email Addresses Before Sending (Node.js)

Most developers check email format and call it done. That's not enough.

A perfectly formatted address can still bounce if the domain has no mail servers, or if it's a throwaway like Mailinator.

Here's how to validate properly before sending:

curl -X POST https://api.primetimemail.com/v1/validate \
  -H "X-API-Key: ptm_live_..." \
  -d '{"email": "user@example.com"}'
Enter fullscreen mode Exit fullscreen mode

Checks format, MX records, disposable domains, and your suppression list in one call.

Response tells you exactly what failed:

{
  "valid": false,
  "checks": { "format": true, "mx": false, "suppressed": false },
  "reason": "Domain has no MX records"
}
Enter fullscreen mode Exit fullscreen mode

Full guide: primetimemail.com/blog/email-validation.html

Top comments (0)