Why Verifying Emails Before Sending Is Essential

You send a campaign to 10,000 addresses. 1,200 bounce. Your sender reputation drops. Your next email lands in spam. How much of that should have been avoidable?

Every invalid email you send is a point lost—not just in delivery, but in long-term trust with inbox providers. Mailgun’s API lets you check email validity at the SMTP level, before you even send. That’s not luck. It’s prevention.

Using the Mailgun API to verify email addresses before sending in PHP isn’t a luxury. It’s how you keep your list clean, your inbox placement stable, and your sender reputation intact—especially at scale.

Key takeaways

  • Mailgun’s API performs real-time SMTP-level checks to confirm email validity before sending.
  • Verifying emails reduces bounce rates and protects sender reputation, directly improving inbox placement.
  • Integrating email verification into your PHP workflow via Mailgun API prevents wasted sends and improves campaign performance.

How Mailgun API Validates Emails in Real Time

Mailgun API checks every email address in real time by verifying syntax, confirming domain existence, and testing reachability through the recipient’s mail server. It connects directly to the MX record and attempts a brief SMTP handshake—immediately returning a verdict: valid, invalid, catch-all, or risky—before your email ever leaves your system. This keeps your sends clean, reduces bounces, and protects your sender reputation.

What Happens Behind the Scenes

When you send a request to the Mailgun API, it doesn’t just scan for @ symbols and dots. It parses the address using standard RFC 5322 rules, then confirms the domain resolves via DNS. If the domain is valid, Mailgun attempts to contact the mail server directly using the domain’s MX records.

This SMTP-level reachability check is the most reliable indicator of whether a mailbox actually exists. Some servers reject invalid addresses instantly. Others accept them but return a temporary failure. The API captures these responses and classifies each address accordingly—giving you real-time feedback based on actual infrastructure behavior.

Immediate Feedback, No Guesswork

Within milliseconds, Mailgun returns structured data indicating whether the email is valid, temporarily unreachable, or likely a catch-all (where all addresses on the domain accept mail). Catch-alls are common with older systems, shared domains, or role-based addresses like [email protected], and can inflate your bounce rate if not caught early.

You can use this feedback to filter invalid or risky addresses before sending. For example, if an email returns as "risky" due to greylisting or rate-limiting, you might delay delivery or remove it from the list entirely. This prevents wasted sends and protects your deliverability.

While Mailgun’s API is powerful, it’s not the only tool that does this. Other services like SendGrid or Postmark offer similar verification, but with different trade-offs in speed, accuracy, and cost. For broader verification, some teams use a dedicated email validation service like Emaillistchecker’s real-time API, which supports bulk verification with 98.9% accuracy and integrates with Mailchimp, HubSpot, and Klaviyo.

Ultimately, real-time validation isn’t just about checking syntax—it’s about mimicking how real mail systems respond. It’s the difference between guessing and knowing. And knowing lets you send only to addresses that will actually receive your message.

How to Use Mailgun API to Verify Email Addresses Before Sending in PHP

You can verify email addresses before sending with Mailgun’s API using a simple PHP script with cURL. Send a request to /v3/validated/addresses with your API key, domain, and the email to check. Parse the response to detect invalid, catch-all, or risky addresses, then filter them out before sending. This stops bounces, protects sender reputation, and improves inbox placement.

Step-by-step process

  1. Initialize cURL and set the endpoint — Create a cURL handle in PHP and set the Mailgun API URL for validating an address, e.g., https://api.mailgun.net/v3/yourdomain.com/validated/addresses. Replace `yourdomain.com` with your actual Mailgun domain.
  2. Include your API key and email — Pass your Mailgun API key as a basic auth credential. Send the email address in the request body as a form field named address. Use curl_setopt($ch, CURLOPT_USERPWD, 'api:YOUR_API_KEY') for authentication.
  3. Send the request and capture the response — Execute the cURL call and store the JSON response. Mailgun returns status codes (200 for valid, 400 for invalid) and fields like is_valid, is_risky, and is_catch_all to indicate the address state.
  4. Parse the verdict — Check is_valid for true/false. If is_catch_all is true, the domain accepts all emails — likely a spam trap. If is_risky is true, the email may have low deliverability — use caution. These responses help you decide whether to proceed.
  5. Filter before sending — Only pass verified, non-risky emails to Mailgun’s /messages endpoint. This reduces hard bounces and protects your sender reputation, helping you avoid deliverability issues seen in Spamhaus blocklists.

Best practices and limitations

Mailgun’s validation checks syntax, DNS records, and MX existence, but doesn’t confirm if the mailbox is actually active. A valid address might still be inactive or marked as spam. For higher accuracy, pair this with a dedicated email verification service like EmailListChecker’s API, which uses multiple layered checks including SMTP and inbox placement simulation.

Use the bulk verification tool for large lists. It supports real-time API integration and provides a 98.9% accuracy rate across domains, including disposable email detection and role account filtering — key for reliable sending.

Always verify domains on your Mailgun account before using the API. Misconfigured domains lead to failed validation requests. For tools integrating with CRM or marketing platforms, see the integrations page to connect with Mailchimp, HubSpot, or SendGrid safely.

Verification isn’t just about syntax — it’s about sender health. Every bad address degrades reputation, even if it doesn’t technically bounce.

Step-by-Step: Integrate Email Verification into Your PHP Mailgun Workflow

You can verify email addresses before sending through Mailgun’s API by installing the PHP SDK, authenticating with your domain and API key, calling the verify() method on the client, then inspecting the response for is_valid and risk levels. Only proceed with sending if the email is valid and low-risk. This avoids bounces, protects sender reputation, and improves deliverability — a standard practice in email delivery best practices.

  1. Install the Mailgun PHP SDK using Composer: composer require mailgun/mailgun-php. This gives you access to the official client with verified, up-to-date methods that follow RFC standards for email validation and delivery.
  2. Authenticate your client with your Mailgun domain and API key. Store the key securely — never expose it in client-side code. This step is required for all API calls and ensures your requests are trusted by Mailgun’s servers.
  3. Create a function to call ->verify() on the Mailgun client with the email address you want to check. The method returns a response object with metadata about the address, including whether it’s valid, if it’s a role-based address, and whether there are delivery risks.
  4. Check the response object fields:
    • is_valid: Must be true to proceed.
    • did_you_mean: Suggests a possible typo correction — useful for auto-correcting common misspellings.
    • role: Indicates if the email is a role account (like admin@ or sales@), which may signal lower engagement.
    • risk: A value like high, medium, or low. If risk is high, skip sending.
  5. Only send an email if is_valid is true and risk is absent or set to low. Skipping high-risk or invalid addresses prevents deliverability issues and reduces the chance of being flagged by spam filters.

Why This Matters

Email verification before sending is a fundamental part of maintaining a good sender reputation. According to Spamhaus, high bounce rates from invalid addresses are a key signal for blacklisting. Even a few bad emails can damage your domain’s trust score over time.

Next Up: Scale with the Right Tool

If you’re working with hundreds or thousands of emails, manually verifying each one isn’t scalable. Use a tool like bulk verification to process large lists efficiently. The Emaillistchecker API also supports real-time verification, integrates with platforms like Mailgun, and offers detailed feedback on risk factors, catch-all domains, and disposable addresses — all within a single workflow.

Understanding Mailgun's Email Verification Response Codes

Mailgun’s email verification API returns specific codes that tell you exactly what’s wrong with an email address. A "valid" means the address is real and deliverable. "Invalid" means the syntax is broken or the domain doesn’t exist. "Catch-all" means the domain accepts all emails—potentially a red flag. "Risky" flags addresses that are disposable, role-based, or likely to bounce. These codes help you filter out bad data before sending.

Interpreting Mailgun’s Verification Codes

Each response code maps directly to a real delivery risk or technical condition. Knowing what each one means lets you build smart filtering logic in your PHP app. Let’s break down the official Mailgun codes and what they mean in practice.

Response Code Meaning Recommended Action Related Risk
valid The email address exists, the domain resolves, and SMTP-level checks confirm it accepts mail. Proceed with sending. This is your target quality tier. Low – inbox placement typically 85–95% for validated addresses.
invalid The email has a syntax error (like missing @) or the domain doesn’t resolve in DNS. Remove from your list. These will bounce immediately. High – sending to invalid addresses harms sender reputation.
catch-all The domain accepts all emails, even malformed ones. No real validation occurs on the recipient side. Flag for review. Avoid sending campaigns to catch-all domains. High – often used by disposable services or poorly configured domains.
risky The address is likely disposable, role-based (e.g., admin@), or associated with high bounce rates. Do not send to high-value content. Consider tagging for suppression. Medium–high – risk of hard bounces, complaints, or inbox filtering.

Understanding these codes is crucial. For example, a catch-all address may not bounce—but it also won’t engage. Sending to it wastes send credits and can trigger spam traps if overused. Role-based addresses (like info@ or support@) are common in low-engagement lists and often lead to high bounce rates, even if the domain is valid.

You can find similar code meanings in other email verification services like Bouncer, Emailable, and NeverBounce. However, Mailgun’s API is transparent—its response codes align closely with SMTP behavior. You’ll see similar patterns in RFC 5321 and RFC 5322, which govern email routing and syntax.

If you’re building a PHP system that sends bulk emails, verifying before sending with a service like EmailListChecker’s API gives you more control. It supports the same response codes but adds inbox placement testing and bulk processing with 98.9% accuracy. For a full verification workflow, see bulk verification or integrate via our Mailgun-compatible API.

How to Combine Mailgun Verification with Emaillistchecker.io for Better Accuracy

You can boost your email deliverability by verifying addresses with Emaillistchecker.io before sending via Mailgun’s API. While Mailgun checks SMTP reachability, it doesn’t detect disposable emails or role accounts with full precision. Emaillistchecker.io adds 98.9% accuracy by validating against real-time databases of spam traps, role-based addresses, and disposable domains. Run your list through Emaillistchecker.io’s real-time API first, then send only valid addresses through Mailgun’s send endpoint.

Mailgun’s Limitations and Why They Matter

Mailgun’s API validates email syntax and confirms SMTP reachability—meaning it can verify if a domain accepts mail and whether an inbox exists. But it doesn’t analyze the email’s content or origin. Role accounts like admin@ or sales@ are technically valid but often ignored by recipients. Disposable domains (like tempmail.org) are usually temporary and used for spam. These are not flagged by Mailgun’s core checks, but they still hurt sender reputation. According to RFC 6531, address validity and sender reputation depend on more than just SMTP reachability.

Emaillistchecker.io Fills the Gaps

That’s where Emaillistchecker.io steps in. Its verification engine cross-references each email against known red flags: role addresses (e.g., info@, support@), disposable domains, and known spamtrap networks. This gives you a full risk profile before you send. The 98.9% accuracy rate comes from persistent data updates and real-world feedback loops—not just static rules. It’s not a one-time check; it’s a continuous validation layer.

Let’s say you have 10,000 email addresses. Instead of blasting them through Mailgun and risking high bounce rates, first run them through Emaillistchecker.io’s real-time API. Filter out invalid, risky, or disposable emails. Then, only send the clean subset via Mailgun. This reduces bounce rates, keeps your IP from being blacklisted, and improves inbox placement.

You can automate this via Emaillistchecker.io’s bulk verification tool or integrate the API directly into your PHP workflow. The process is fast and scalable. No need to wait for Mailgun to reject an email after it’s sent. You catch problems before they count against you.

Real Use Case: Pre-Verify 10,000 Addresses Before a Campaign

You load a list of 10,000 emails in PHP, loop through them using Mailgun’s API with a 1,000-per-minute rate limit, collect results—invalid, catch-all, risky—then filter out the bad ones. Only valid, low-risk addresses proceed to your campaign. This cuts bounces, protects sender reputation, and improves inbox placement. Let’s walk through how.

Step-by-Step: Pre-Verify & Clean Your List

  1. Load your email list. Use PHP’s file() or json_decode() to read the list from a file or database. A 10,000-email list is manageable in memory with proper streaming if needed. Processing large batches in chunks avoids memory issues.
  2. Set up Mailgun API access. Authenticate with your Mailgun API key and domain. You’ll need to send a POST request to https://api.mailgun.net/v3/address/validate for each email. Rate-limiting is enforced at 1,000 checks per minute—exceeding it triggers 429 errors.
  3. Process each email with a loop and delay. Use sleep() or a queue-driven approach to pause between requests. Processing 10,000 addresses at 1,000 per minute takes about 10 minutes. This keeps your sender reputation intact during verification.
  4. Parse the API response. Mailgun returns one of several status codes: valid, invalid, catch-all, or risky. You can ignore invalid emails completely. catch-all and risky addresses often bounce or land in spam—filter them out to protect deliverability.
  5. Build a clean send list. Only retain addresses marked valid. Optionally, log or export the filtered list for review. This step drops the average bounce rate from 15% to under 3% in practice for lists with poor hygiene.
  6. Send your campaign. Use Mailgun’s send API with the cleaned list. Fewer bounces mean less strain on your sender reputation. Tools like Spamhaus and RFC 5321 show that consistent low bounce rates are key to avoiding blacklists.

Why This Matters in Practice

Without pre-verification, sending to a 10% invalid rate means 1,000 of your 10,000 sends fail before they even load. Each soft/hard bounce hurts your sender reputation. Mailgun’s validation is solid, but only for syntax and basic checks. For deeper risks—like disposable or role-based addresses—add a dedicated tool. Bulk verification offers higher accuracy and catches issues beyond SMTP, like expired domains or mailbox blacklists.

Clean lists don’t just reduce bounces—they boost engagement. Deliverability improves when you only reach active, real users. This isn’t just technical hygiene; it’s a requirement for long-term email marketing success. You can also integrate your verifier with tools like Klaviyo or HubSpot for automated list hygiene over time. For real-time validation, our API integrates with your PHP stack seamlessly.

When to Use Emaillistchecker.io Instead of or Alongside Mailgun API

You should use Emaillistchecker.io to clean your entire email list before sending—filtering out role accounts, disposable domains, and catch-alls that Mailgun’s SMTP checks alone won’t catch. It runs deeper checks like mailbox age and disposable domain reputation, which SMTP can’t verify. Then pair it with Mailgun’s real-time API for syntax and sender reputation validation. This dual-layer approach reduces bounces and boosts deliverability. Start with 100 free verifications—credits never expire. Learn how credits work.

Bulk List Cleaning You Can’t Do With SMTP Alone

  • Mailgun’s API checks syntax and basic SMTP reachability—but not whether an address is a role account like info@ or admin@. Emaillistchecker.io identifies these patterns and flags them before you send.
  • It scans against up-to-date disposable email domain lists. These domains are often used for spam or fake signups, and many SMTP checks don’t detect them reliably.
  • Using bulk verification cleans your list in one go, removing invalid, risky, or low-quality addresses before you even touch Mailgun.
  • Some domains have catch-all configurations, meaning every email is accepted—even if the username doesn’t exist. Emaillistchecker.io detects this, so you don’t waste delivery attempts on false positives.

Combine for Dual-Layer Email Validation

  • Use Emaillistchecker.io first to screen and clean your list. This layer handles reputation, domain type, and mailbox age.
  • Then run Mailgun’s real-time validation endpoint on the cleaned list for final syntax and sender reputation checks. This ensures your sender domain is properly authenticated (SPF, DKIM, DMARC).
  • This two-step flow reduces bounce rates more reliably than either tool alone. It’s an industry-standard practice to validate at multiple layers—similar to how RFC 7504 outlines mail acceptance processes.
  • Once verified, use the real-time API to validate individual addresses on signup, catching issues early.
  • You don’t need to choose one tool. The real power comes from using both: Emaillistchecker.io for deep cleaning, Mailgun for final real-time checks.

You’re not replacing Mailgun—you’re layering more accuracy on top. With 100 free verifications to start and credits that never expire, there’s no risk in testing the difference.

Best Practices for Maintaining Email List Health with API Verification

You should verify every email address before sending using an API like Mailgun’s or a dedicated service. Doing so prevents hard bounces, protects your sender reputation, and improves inbox placement. Always verify new sign-ups in real time and recheck existing lists every 3–6 months. Avoid sending to catch-all domains—they accept all emails but signal poor list hygiene. If your bounce rate rises above 2%, it’s time to scrub your list. This is not optional.

Verify Before You Send

  • Do not send any campaign to a raw list without first running it through a verification API.
  • Use the Mailgun API or similar tools to validate addresses in real time during sign-up.
  • Integrate verification at the point of entry: when users submit their email, verify it immediately.
  • Never assume an address is valid—syntax checks alone aren’t enough. Real-time SMTP checks catch disposable and invalid domains.

Keep Lists Clean Over Time

  • Re-verify existing subscribers every 3–6 months to remove outdated or changed emails.
  • Run bulk verification on your entire list prior to large sends to avoid sudden spikes in bounce rates.
  • Avoid sending to catch-all domains. These domains accept all incoming mail but don’t represent real users, degrading your sender reputation over time.
  • Monitor your delivery rate: if hard bounces exceed 2%, pause sends and re-scrub the list. This threshold is commonly recognized in email deliverability best practices.
Consistent list hygiene isn’t just about reducing bounces—it’s about protecting your sending reputation. A single high bounce rate can trigger sender reputation penalties across major email providers.

For scalable and accurate verification, use a dedicated email validation API. Tools like EmailListChecker’s API integrate seamlessly with your PHP stack and verify at scale with 98.9% accuracy. If you send via Mailgun, pair it with real-time validation to catch issues early.

To bulk-verify large datasets or test deliverability in real inboxes, use bulk verification or inbox placement testing. Many teams use integrations with Mailchimp, HubSpot, or Klaviyo to automate verification across platforms.

The bottom line: verification is not a one-off step. It’s part of consistent deliverability maintenance. Let your API handle validation so your messages reach inboxes—not bounces.

How Email Verification Prevents Spam Traps and Protects Sender Reputation

Verifying emails before sending with Mailgun API stops you from hitting spam traps—old or abandoned addresses designed to flag bad senders. These traps are common in outdated lists, and sending to them damages your sender reputation. A clean list reduces hard bounces and spam complaints, keeping your reputation strong and inbox placement reliable, especially at scale.

Spam Traps Are Designed to Catch Poor Lists

Spam traps aren’t real users. They’re inactive email addresses maintained by blacklist providers and ISPs to detect negligent sending. You likely have them in old or unengaged segments of your list. Sending to these addresses—especially in high volumes—gets your IP or domain flagged, often leading to blacklisting.

According to the Messaging, Malware, and Mobile Anti-Abuse Working Group (M3AAWG), spam traps are one of the core tools used to police email sender behavior. They’re not just about filtering—when you trigger one, it can mean your next campaign lands in the trash folder or is blocked entirely.

Verification Filters Out the Traps Before They Cause Damage

When you verify emails before sending—via Mailgun API or a dedicated tool like bulk email verification—you eliminate addresses that fail basic eligibility checks. This includes known spam traps, invalid formats, and domains with poor delivery records. You’re not guessing; you’re testing against real SMTP servers, catch-all patterns, and reputation databases.

Even if your list has a low bounce rate, a single spam trap can hurt your reputation. Verification removes that risk. With a cleaner list, you reduce hard bounces (which hurt deliverability) and avoid triggering spam complaints (which degrade your sender score).

Keeping your sender reputation intact is non-negotiable. ISPs like Gmail, Outlook, and Apple use reputation metrics—like engagement, bounce rate, and spam complaints—to decide whether to deliver your mail. A single misstep can cause a cascade of blocked messages. Verification is your first line of defense.

Summary: Layered Verification Ensures Deliverability and Trust

Using Mailgun’s API for real-time email verification is a foundational step in ensuring only valid addresses are sent to. It catches syntax errors and immediately invalid domains before messages are dispatched.

But real-time API checks alone don't cover all risks. Pairing Mailgun with Emaillistchecker.io adds layered validation—catching role accounts, disposable domains, greylisting traps, and invalid addresses hidden behind catch-all responses. Together, they cover the full spectrum of email deliverability risks.

Verification isn’t a luxury—it’s required for sustainable email campaigns. Without it, bounces rise, sender reputation degrades, and inbox placement suffers. Trust and reliability begin with confirming a single email before it’s ever sent.

Keep reading

Ready to put this into practice? Emaillistchecker.io verifies emails with 98.9% accuracy — start with 100 free verifications.

Frequently asked questions

Can Mailgun verify emails in bulk?

Mailgun supports bulk verification through its API, but rate limits apply. For large datasets, use Emaillistchecker.io for faster, scaled processing with real-time API.

Does Mailgun detect disposable email addresses?

Mailgun’s API does not guarantee detection of all disposable domains. Use Emaillistchecker.io for comprehensive disposable email filtering.

What happens if I send to a catch-all email?

Catch-all domains accept any email, but they are often associated with spam traps or low engagement. Sending to them can harm your sender reputation.

How does real-time email verification improve deliverability?

By filtering invalid, risky, or role-based addresses before sending, real-time verification reduces bounces and spam complaints, improving overall inbox placement.

Can I integrate Emaillistchecker.io with PHP?

Yes. Emaillistchecker.io offers a real-time API that works natively with PHP through HTTP requests, making integration with your existing Mailgun workflow straightforward.

Is Emaillistchecker.io more accurate than Mailgun’s API?

Emaillistchecker.io reports 98.9% accuracy by validating against role, disposable, and spamtrap databases beyond SMTP checks. It's designed to complement, not replace, Mailgun’s verification.

Do I need to verify emails every time I send?

No. But re-verify when building new lists, after long inactivity, or if bounce rates exceed 1%. Regular checks maintain list hygiene.

How many free verifications does Emaillistchecker.io offer?

You get 100 free verifications to start. Any purchased credits never expire, so you can use them as needed.

Can I use Emaillistchecker.io with Mailgun?

Yes. Emaillistchecker.io supports integration with Mailgun, Mailchimp, HubSpot, Klaviyo, and SendGrid via API or direct import.

What’s the difference between a valid and a risky email?

A valid email is syntactically correct and accepted by the mail server. A risky email may be role-based, disposable, or from a known spam source, increasing bounce or spam risk.

How does SMTP verification work?

SMTP verification connects to the recipient's mail server and attempts to validate the address via the RCPT TO command. It confirms whether the server accepts mail for that address.

Can I automate email verification in PHP with cron?

Yes. Schedule PHP scripts via cron to verify new sign-ups or re-check existing lists regularly, preventing list decay and maintaining deliverability.