How to Detect Disposable Email Addresses in Symfony
Disposable email addresses let users register with throwaway inboxes, abuse free trials, and disappear without a trace.
For Symfony applications, the cleanest solution is a single API call at the point of registration that catches these addresses before they reach your database.
This guide shows you how to integrate Spamova's disposable email detection into a Symfony application using the HttpClient component.
What You Will Need
A Spamova API key from your account. Store it in your Symfony environment configuration - never hardcode it in your application.
In .env:
Checking a Single Email Address
Symfony's HttpClient component handles the API call cleanly. The /api/v1/check endpoint accepts a POST request with a single email and returns a full result object.
The response looks like this:
syntax catches malformed addresses before any further processing. is_disposable is the primary flag. risk_score provides a 0-100 confidence level for handling ambiguous domains that are suspicious but not yet confirmed on any list. mx validates that the domain has functioning mail infrastructure. website_status reveals whether the domain resolves to a real website, redirects elsewhere, or returns nothing.
Adding a Custom Validator Constraint
The idiomatic Symfony approach is a custom constraint and validator. This integrates cleanly with Symfony's form and validation system and can be applied to any form type or DTO.
First, create the constraint:
Then create the validator:
Wire the API key in services.yaml:
Then apply it to your registration DTO or form:
Checking Multiple Emails at Once
For auditing existing users or processing imported contact lists, use the /api/v1/bulk endpoint. It accepts up to 100 emails per request and returns a results array alongside a meta object showing checks used and remaining quota.
Requests with more than 100 emails are rejected in full. Split larger arrays into chunks of 100 before sending, processing each batch separately.
Get Started
Get your API key from your account, wire it into your services.yaml, and apply the constraint to your registration form. Disposable email protection is live in your Symfony application in minutes.