Article

How to Self-Host an Email Verification API: Practical Steps and Trade-offs

By Unlimited Verifier Team ·

Diagram of a self-hosted email verification API showing the API layer, job queue, SMTP probe workers, egress IP addresses and results database.

Summary

Self-hosting an email verification API means wrapping an open-source SMTP verifier such as Reacher's check-if-email-exists in your own HTTP endpoint, with a job queue, throttled probe workers and a results store. Server costs are the smallest part; the hard parts are getting mail servers to accept your probes and handling Unknown results correctly.

Self-hosting an email verification API means running an SMTP verification engine such as Reacher's check-if-email-exists behind your own HTTP endpoint, with a job queue, per-domain throttling and a probe server that can open outbound port 25. The server bill is the smallest cost. The hard part is getting receiving mail servers to accept your probes and give you usable answers.

Quick answer

What does self-hosting an email verification API actually involve?

A self-hosted verifier is a small system, not a single program. Your applications call an HTTP endpoint. Behind it, workers run syntax, DNS and SMTP checks, and the results land in a database. You pay for servers, outbound IP addresses and maintenance, instead of a subscription or per-address fee.

The working parts are:

Bottom line: You are operating a mail-adjacent service, so plan for uptime, abuse control and IP reputation from day one.

Why would you self-host instead of using a hosted API?

Teams usually self-host for four reasons: data residency, custom logic, very high volume and existing engineering capacity. Data residency is the most common driver. When addresses never leave your network, email verification compliance and hygiene reviews in regulated sectors get simpler. We cover that trade-off in self-hosted email validation for data residency.

The downside is less obvious. Every SMTP probe is traffic from your IP addresses to a third party's mail server. If you probe too fast, or from a poorly configured host, providers throttle or block you. A hosted vendor absorbs that operational risk across its customer base. You have to absorb it yourself.

Bottom line: Self-host for control and data location. Don't self-host expecting a automatically lower bill.

What are your options for a self-hosted verifier?

Your realistic options are a custom build, an open-source engine you operate, a hosted API or a hosted bulk tool. They differ mainly in setup time and in who owns the sending reputation.

Option Setup effort Main recurring cost Who owns probe IP reputation Addresses leave your infrastructure? Best fit
Build from scratch (see how to build an email verification service from scratch) Usually weeks to months: SMTP, DNS, queueing, list maintenance Servers, proxies, engineering time You No Unusual requirements and in-house mail expertise
Self-host an open-source engine (e.g., Reacher's check-if-email-exists, written in Rust, or the Unlimited Verifier GitHub engine) Days to a few weeks to add the API, queue and throttling Servers, egress IPs, refreshing disposable and role lists You No Data-residency needs with engineers available
Hosted verification API (e.g., Unlimited Verifier's email verification API) Hours: get a key and make a first call Subscription; standard verification is unlimited on every plan Vendor Yes, addresses go to the vendor Fixed monthly cost with no mail infrastructure
Hosted bulk tool (CSV upload) Minutes Subscription Vendor Yes, addresses go to the vendor One-off list cleans with no integration work

For a deeper comparison, read Reacher vs paid email verification services and pros and cons of open-source email verifiers. Our roundup of hosted tools covers the commercial side.

Open-source engines give you the verification logic, but not the operational layer. Disposable-domain lists, catch-all handling and provider-specific behaviour all need ongoing work.

Bottom line: Open-source engines give you the checks. A hosted API gives you the checks plus someone else's IP reputation and upkeep.

How does an SMTP mailbox check work, and what do the responses mean?

An SMTP mailbox check opens a conversation with the recipient's mail server and asks whether it would accept mail for that address. The sequence is EHLO, MAIL FROM, RCPT TO, read the reply, then QUIT. You never send DATA, so no message body is transmitted.

Reply codes are defined in RFC 5321, and the enhanced status codes such as 5.1.1 are defined in RFC 3463. Your engine has to map each reply to a verdict:

Server response What it usually means What your engine should record
250 after RCPT TO Recipient accepted Valid candidate; run the catch-all test
550 5.1.1 Mailbox does not exist Invalid
550 5.7.x or 554 policy text Probe blocked for policy or reputation Unknown; retry from another route
421 Service unavailable or too many connections Back off; Unknown if it persists
450 or 451 Temporary failure, often greylisting Retry later; never mark Invalid
Timeout or refused connection on port 25 Port blocked, host down or network fault Infrastructure fault, not a verdict on the address

Most self-hosted verifiers fail in the non-answer rows. A common error is treating every non-250 as Invalid, which inflates your bad-address count. The opposite error is treating timeouts as Valid. Keep the categories separate.

Bottom line: Much of the accuracy difference comes from how you classify non-answers, not from the 250 and 550 cases.

What architecture should a self-hosted verification API use?

Run each address through the same ordered pipeline, and stop early when a check is decisive. Cheap checks run first, so SMTP probes go only to addresses that deserve one.

  1. Intake: validate the JSON, trim whitespace, deduplicate and reject empty fields.
  2. Syntax check: follow the RFC 5321 and 5322 rules for local parts and domains. A simple regex rejects some valid but unusual addresses and accepts some invalid ones.
  3. Domain and MX lookup: query MX records. If none exist, RFC 5321's implicit MX rule falls back to the domain's A record. A "null MX" record (RFC 7505) says the domain accepts no mail, so classify it as Invalid.
  4. Flags: check disposable, role-based (such as info@) and free-provider lists. These are classifications, not failures.
  5. Catch-all test: probe a random nonexistent address on the same domain. If it is accepted, the domain accepts everything, and the real address cannot be confirmed. The open-source catch-all detection tools article compares ways to run this check.
  6. SMTP probe: send through a per-domain throttled queue, with retries for temporary failures.
  7. Classify and store: map each result to Valid, Risky or Invalid (plus Unknown, if you keep that category), and cache it with a timestamp.

Bottom line: Order checks cheapest first, and let the queue, not the probe loop, enforce politeness.

How do you self-host an email verification API, step by step?

Self-hosting takes eight steps, in order: choose and read the engine, provision a probe server with port 25 and reverse DNS, set the sending identity, wrap the engine in an API, add per-domain throttling, add caching and retries, maintain the lists, and benchmark before switching. Each step prevents a failure that teams commonly hit when they skip it.

  1. Choose and read the engine. Check the licence, the date of the last commit and how it handles catch-all domains. Confirm you can update its disposable and role lists without a rebuild. Why: an unmaintained engine degrades silently as providers change behaviour.

  2. Provision the probe server. Use a static IP, confirm outbound port 25 is open (many cloud providers and residential ISPs restrict it by default, so ask before you build), and set a reverse DNS (PTR) record. Why: receiving servers often check that the sending IP's reverse DNS matches the hostname you announce in EHLO.

  3. Configure the sending identity. Set EHLO to a hostname you control, publish an SPF record for the sender domain, and use a sender address on that domain. Why: a missing or inconsistent identity makes providers treat your probes as suspicious.

  4. Wrap the engine in an HTTP API. Add API keys, TLS, request size limits and per-key rate limits. Why: an open verifier gets abused, and abuse burns the IPs you rely on.

  5. Add the queue and per-domain throttling. Limit concurrent connections per receiving MX host, and back off on 421. Why: one provider's rate limit can block every address you send to it, for every customer on your platform.

  6. Add caching and retry rules. Cache results per address for a fixed window, and schedule retries for 450, 451 and timeouts rather than classifying them at once. Why: re-probing the same address spends reputation for no new information.

  7. Maintain the lists. Refresh disposable-domain and role-address lists on a fixed schedule. Our email list maintenance best practices guide covers the cadence. Why: new disposable providers appear constantly, and stale lists miss them.

  8. Benchmark, then shadow-run. Test against a labelled sample (see below), then run the self-hosted verifier beside your current tool for two to four weeks before switching. Why: you need evidence that it classifies your data the way your bounce history says it should.

Bottom line: Steps 2, 3 and 5 decide whether your verifier works. The verification logic is the easier part.

Hands-on: how do you run your first SMTP probe?

Run one probe by hand before you build the API, so you can see the handshake. This sketch uses Python with dnspython. It is for learning, not production: it has no retries, no per-stage timeouts and no catch-all test.

  1. Install the dependency. Run pip install dnspython.
  2. Choose a sender identity on a domain you control, such as verify@yourdomain.com, and publish SPF for that domain.
  3. Save the script below as probe.py, updating the sender and EHLO name.
  4. Run it against an address you own, then against a deliberately fake address on the same domain.
  5. Read the output. A 250 on the fake address suggests a catch-all domain. A 550 5.1.1 on the fake address is the normal behaviour you want.
  6. Check reverse DNS for your sending IP. If it does not match your EHLO name, fix that before going further.
import smtplib
import dns.resolver

def probe(email, sender="verify@yourdomain.com", ehlo_name="verify.yourdomain.com"):
    domain = email.split("@", 1)[1]
    mx_records = sorted(dns.resolver.resolve(domain, "MX"), key=lambda r: r.preference)
    mx_host = mx_records[0].exchange.to_text().rstrip(".")
    with smtplib.SMTP(mx_host, 25, timeout=10) as server:
        server.ehlo(ehlo_name)
        server.mail(sender)
        code, message = server.rcpt(email)  # never call server.data()
        return code, message.decode(errors="replace")

print(probe("someone@example.com"))

Two gaps matter. The script raises an exception if the domain has no MX record, which production code must handle. It also tries only the first MX host, while production code should fall back to the others on failure.

Bottom line: One manual probe shows you more about your network and sending identity than any setup guide.

How much does self-hosting cost compared with an API subscription?

Self-hosting looks cheap on a server invoice and expensive on a total-cost view. The model below is illustrative at 100,000 verifications a month. Every figure except the Unlimited Verifier price is an assumption to replace with your own.

Assumptions (illustrative, not quotes):

Self-hosted monthly total: $40 + $60 + $10 + $400 + $200 = $710/month, or $7.10 per 1,000 verifications.

Hosted comparison: Unlimited Verifier's Pro plan is $29/month, or $25/month billed annually. It includes API access for up to 100,000 emails a month. At full use, that is $0.29 per 1,000 on monthly billing, or $0.25 per 1,000 annually. Standard verification has no per-email fee. Deep verifications are capped separately at 25,000 a month on Pro, so a workload that relies on deep checks needs its own calculation. Check the current sign-up and plan details before you decide.

Remove the build cost and the self-hosted figure is still $510/month, or $5.10 per 1,000, mostly from maintenance time. Hosting is a small share of the total. Self-hosting tends to pay off on cost only when volume is much higher than in this example, your engineers already run similar systems, or you need the data to stay in-house. The self-hosted vs SaaS email verification cost analysis works through the break-even point.

Bottom line: At this volume, people time is the cost that matters. Self-host for control, not for a lower bill.

How fast can a self-hosted verifier process a list?

A 100,000-address list takes about 11 hours in the example below, and the limit is your largest receiving provider's per-domain cap, not your server's speed.

Illustrative example: 100,000 addresses, 40% at one large consumer provider (40,000 addresses), and 60% spread across many other domains.

The queues run in parallel, so wall-clock time is set by the slowest one: about 11 hours. Adding servers won't shorten it, because the cap is per domain. Start the large-provider queue first, and schedule other work around it.

If you use a hosted tool instead, the same arithmetic still applies to your list size. On Unlimited Verifier's Pro plan, each list can hold up to 25,000 emails, so a 100,000-row file becomes four uploads of 25,000. Each file must also stay under the 10MB upload limit, so check size on wide CSVs. The bulk upload page accepts CSV and Excel files with automatic email-column detection.

Bottom line: Budget runtime from your largest provider's cap, not from server speed.

Why does a self-hosted verifier return so many Unknowns?

Unknowns usually come from the receiving side. Mail providers defer, rate-limit or refuse probes from IP addresses they don't recognise, and some accept every recipient, so the mailbox can't be confirmed. Unknowns cluster on domains with strict anti-abuse policies, and on domains that accept everything.

Treat Unknown as its own outcome. Retry after a delay, route through a different egress IP if you have one, and place it in your Risky bucket rather than Valid. Our guide to why self-hosted email verification returns Unknown walks through the causes. Do you need proxies for SMTP email verification covers when egress diversity helps and when it creates new problems.

Hosted services face the same ceiling. A vendor's long-running sending reputation can reduce Unknowns, but no service can confirm a mailbox that the receiving server won't confirm.

Bottom line: An Unknown reflects a limit on what can be confirmed, not a failed check. Keep it out of your Valid segment.

Is self-hosting email verification legal and compliant?

Yes, self-hosting is generally lawful. The compliance duties follow the data, not the deployment model. An email address is personal data under the GDPR in the EU and UK, so verifying it counts as processing. The UK's Information Commissioner's Office publishes guidance on the principles that apply, including data minimisation and storage limitation. Keep only the fields you need, delete raw probe logs on a fixed schedule, and document your lawful basis.

Unlimited Verifier keeps results for 24 hours on the Free plan and 30 days on Pro. If your audit needs run longer, store your own history, which self-hosting already requires.

Operationally, the rules concern behaviour. Probes should never include message bodies, should be rate-limited, and should avoid repeated attempts against one mailbox. M3AAWG publishes best practices on bulk-sending behaviour, and receiving providers look for these patterns when deciding whether to block a source.

Verification also does not establish consent. An address that exists is not an address that agreed to receive your email. That obligation is separate, and email verification for sales prospecting covers how to handle it.

Bottom line: Self-hosting moves the compliance work onto you. It does not remove it.

How do you know your self-hosted verifier is accurate?

Measure accuracy against addresses whose outcome you already know. Build a labelled test set from your own records:

Run all of them through your verifier and count two errors. A false positive is a known-bad address classed as Valid. A false negative is a known-good address classed as Invalid. Track them separately, because they cost different things: false positives hurt deliverability, and false negatives waste reachable contacts.

In production, use real bounces as the ground truth. After each send, measure the bounce rate of the cohort your verifier marked Valid. If it climbs, the verifier is passing addresses it should have caught.

For reference, Unlimited Verifier states 99.5% accuracy for deep verification. That is the company's own figure, not an independent benchmark, so run your own test set before relying on it, whichever tool you choose.

Bottom line: Benchmark on your own labelled sample, and track Valid-cohort bounces after every send. A vendor or open-source accuracy claim is a starting point, not evidence.

When should you self-host, and when should you use Unlimited Verifier?

Self-host when you have a concrete reason: data must stay in your network, your rules differ from any vendor's, or you have engineers who already run mail systems. Otherwise, a hosted API usually costs less in time and risk.

Unlimited Verifier fits the hosted side of that choice:

A practical path works for most teams. Spot-check addresses with the free email checker. Clean the backlog through the bulk upload. Then move signup validation to the API, using real-time email validation as the pattern. Unlimited Verifier has no native ESP, CRM or Zapier integrations, so connecting it to other systems means exporting a CSV and re-importing it, or calling the API from your own code. For risky domains, the catch-all email verification page explains how those results are handled. Teams building email verification for ecommerce and SaaS flows often start with the hosted API and self-host later, if their requirements demand it.

If you do build your own, the email verification API and automation patterns still apply. Generate API keys in the API keys section to compare response formats against your own service.

Bottom line: Self-host for control you actually need. Use a hosted API when the goal is clean data without running mail infrastructure.

Common mistakes that break self-hosted verification

Bottom line: Most self-hosted failures are operational. Fix the network, the sending identity and the queue before you tune the logic.

How we compared (and limitations)

This article is based on public documentation: the RFCs cited above, the public source repositories for open-source verifiers, and Unlimited Verifier's published plan facts. We have not benchmarked any engine against a live receiving provider, and we have not run controlled tests of any service's accuracy.

The cost model and throughput figures are illustrative. Replace the salaries, hosting prices and per-domain limits with your own numbers before you decide. Provider behaviour, port 25 policies and rate limits change without notice, so verify them before you build.

The 99.5% accuracy figure is Unlimited Verifier's own stated number for deep verification, not an independent measurement. Plan features and prices may change, so check the current sign-up and pricing details before you commit. For the broader decision, read the self-hosted email verifier pillar and our email verification server requirements guide.

Self-hosting build framework

Step What to build Done when
1. Engine Install an open-source SMTP verifier and run single checks Known test addresses return expected results
2. API layer Add API keys, request validation, TLS and rate limits Unauthenticated and over-limit requests are rejected
3. Job queue Accept bulk batches and spread them across workers A 10,000-address batch completes without manual steps
4. Probe workers Throttle per domain and per egress IP, back off on temp failures No provider blocks during a controlled test run
5. Results store Cache results, keep audit history, retry Unknown outcomes Unknown results are re-queued, not marked invalid
6. Benchmark Test against a labelled sample from your bounce history False positive and negative rates are measured and documented

Frequently asked questions

Can I self-host an email verification API for free?

The software can be free, since open-source verifiers such as Reacher's check-if-email-exists are available. You still pay for servers, outbound IP addresses, monitoring and engineering time to run them. Those ongoing costs, plus the effort of keeping probes accepted by mail providers, usually make self-hosting more expensive than the license fee suggests.

Do I need port 25 open to verify emails?

Yes, for direct SMTP verification your probe servers must make outbound connections on port 25. Many cloud providers block port 25 by default, so you may need to request an exemption. Without it, your workers cannot open the SMTP conversation that checks whether a mailbox exists.

Why do self-hosted verifiers get blocked?

Receiving mail servers throttle or block IP addresses that send many unsolicited probes, especially from new or poorly configured hosts. Missing reverse DNS, no valid HELO hostname and rapid bursts all raise suspicion. Spreading probes across warmed-up IPs and throttling per domain reduces the risk of blocks.

What does an Unknown result mean in self-hosted verification?

Unknown means the verifier could not reach a confident answer. Common causes are timeouts, greylisting, temporary provider blocks and catch-all domains. It does not prove the address is invalid. Retry Unknown results later, and treat them separately from confirmed invalid addresses before removing anyone from a list.

How do I rate-limit SMTP probes?

Limit concurrent connections per destination domain and per egress IP, add a delay between probes to the same provider, and back off when you see temporary-failure codes. Track response patterns per domain so you can slow down before a provider blocks you. Queue bulk batches so workers pull work at a controlled rate.

Is self-hosting better for GDPR or data residency?

Self-hosting can simplify data residency because email addresses are processed on infrastructure you control rather than a third-party vendor. It does not make you compliant automatically. You still need a lawful basis, retention limits, access controls and a record of processing. Consult your data protection officer for regulated use cases.

How accurate are self-hosted email verifiers?

Accuracy depends on your engine, IP reputation, provider mix and how you handle Unknown results. Generic accuracy claims are hard to trust. The reliable approach is to test against a labelled sample from your own bounce history and measure false positives and false negatives for your actual audience.

How much engineering time does self-hosting take?

Initial setup of the API, queue, workers and storage can take a team several weeks, depending on experience. Ongoing work includes IP warming, blocklist monitoring, engine updates, and handling provider policy changes. Many teams underestimate this maintenance load, which is often the largest cost of self-hosting.

Should I build my own verifier or use an open-source engine?

Most teams start with an open-source engine and wrap it in an HTTP API, because SMTP handling and edge cases are hard to rebuild. Building from scratch only makes sense when you need custom logic that existing engines cannot support. Either way, plan for benchmarking and ongoing maintenance.

Cut Bounces and Protect Your Sender Reputation With Unlimited Email Verification

Every invalid address you send to hurts your sender reputation and your inbox placement. Verifying your list before each send means fewer bounces, healthier deliverability, and a predictable cost. With Unlimited Verifier, standard verification is unlimited on every plan, with no per-email fees.

Unlimited Verifier checks syntax, domain, MX records and the SMTP mailbox. It also detects catch-all domains and flags disposable and role-based addresses. Export a CSV from your email platform or CRM, upload and verify the list, then re-import the clean results. You can also automate checks with the email verification API.

Free Pro
Price $0 $29/month ($25/month billed annually)
Lists 25 a month, up to 150 emails each Unlimited, up to 25,000 emails each
Deep verifications 750 a month 25,000 a month
API access No Yes (100,000 emails a month)
Result retention 24 hours 30 days

Why teams choose Unlimited Verifier

Unlimited Verifier states 99.5% accuracy for deep verification.

Create a free account and verify your next list before you hit send.

Want to test a single address first? Try the free email checker.