How Abstract API Handles Email Validation in Laravel
Abstract API addresses the core weaknesses of traditional methods through real-time SMTP handshakes, identification of low-quality addresses, and a detailed quality score.
- It runs MX and real-time SMTP handshakes without open socket or grey-listing delays inside your PHP worker.
- It flags free, disposable, role, and catch-all domains and proposes autocorrects for common typos.
- It returns a numeric quality score and categorical deliverability, which lets you apply business-specific thresholds.
- It uses a constantly trained machine learning model backed by billions of validations for low-latency results.
How to Add Abstract API to Your Dev Environment
Once you understand Abstract's capabilities, you can add its email validation API to your project with ease.
- Create an Abstract account, enable "Email Verification & Validation," and copy the key.
- Add ABSTRACT_EMAIL_KEY=your_key to your .env file and run php artisan config:cache.
- Ensure you have an HTTP client. Use composer require guzzlehttp/guzzle for Laravel versions before 7. Otherwise, the built-in Illuminate\Support\Facades\Http works.
- Add 'abstract' => ['key' => env('ABSTRACT_EMAIL_KEY')] to your config/services.php file.
- Create a rule that calls the API endpoint with your api_key and email parameters. This rule should interpret the deliverability and quality_score fields.
- Reference that rule in a FormRequest or validator, for example: 'email' => ['required', new \App\Rules\AbstractEmail].
Sample Email Validation Implementation with Abstract API
The custom rule above sends the user-provided email to Abstract API. It then checks the response to confirm the address is deliverable, is not a disposable domain, and meets a quality score of at least 0.8. If these conditions pass, the validation succeeds. Below is a sample JSON response from the API for a valid email.
The response contains several key fields. The "deliverability" field combines all checks into a simple status like "DELIVERABLE". The "quality_score" allows you to tune acceptance thresholds. Granular "is_*" fields provide context on whether an email is disposable or from a free provider, which lets your policies differ for various domains.
Final Thoughts
Traditional validation stops at syntax and DNS checks, so it misses disposable addresses and offers no real deliverability score. Abstract API moves beyond these limits with real-time SMTP handshakes and a numeric quality score.
To reliably validate user emails, create an account on Abstract API and get your free API key.
Frequently Asked Questions
What does Laravel's built-in email validation actually check?
Laravel's default email rule uses the Egulias EmailValidator library to verify that an address conforms to RFC 5322 syntax. It confirms the format looks correct but does not check whether the address is deliverable — a perfectly formatted address pointing to a non-existent inbox will pass the rule without error.
How do you add DNS or MX record checking to Laravel email validation?
You can append the dns parameter to the email rule — for example, 'email:rfc,dns' — which triggers a live MX record lookup for the domain. This catches addresses whose domain has no mail server configured, but it requires the PHP intl extension and adds latency to every request. DNS checks can also produce false positives in environments where the lookup itself fails.
Can Laravel detect disposable or temporary email addresses?
No. Laravel's built-in validation rules — including the dns parameter — cannot identify disposable, role-based, or catch-all email domains. To block throwaway addresses you need an external validation API, such as Abstract's Email Validation API, which maintains up-to-date lists of disposable and free-tier providers and flags them in its response.
What is the Rule::email() fluent builder added in Laravel 11?
Laravel 11.38 introduced Rule::email() as a typed, chainable alternative to the plain string rule. It improves readability and helps prevent mistakes caused by incorrect string parsing of colon-separated parameters. You can chain methods on it to combine RFC checks, DNS lookups, and spoof detection in a single, expressive expression.
Why use an external API instead of Laravel's native email rules?
Native Laravel rules check syntax and, optionally, DNS records, but they cannot perform a real-time SMTP handshake, score deliverability risk, or detect catch-all domains that accept every incoming message regardless of whether the inbox exists. Abstract's Email Validation API adds those layers — returning a quality score, a deliverability category, and flags for disposable and role-based addresses — without introducing raw socket delays into your request lifecycle.
How do you integrate Abstract's Email Validation API into a Laravel custom rule?
Create a class that implements Laravel's Rule contract, then call Abstract's validation endpoint inside the passes method. The rule can reject the address if the API response marks it as not deliverable, flags it as disposable, or returns a quality score below your chosen threshold (the article uses 0.8 as an example). Register the rule in your form request the same way as any other custom rule.


