Skip to content
Projetos

Sobre

Self-hosted email validation API in Go: disposable email detection, MX and SMTP mailbox checks, catch-all and domain age, one 5 MB container. Postfix policy service included.

Produtividade e automação

Como estes números são medidos

O que você pode fazer

  • Syntax check, including internationalized domains (ime@pošta.rs) and Unicode local parts
  • Disposable email detection against over 100,000 domains, subdomains included
  • MX lookup, with null MX (RFC 7505) handled
  • SMTP mailbox check: asks the mail servers, in priority order, whether the mailbox exists, without sending mail

Crescimento medido de estrelas

em 24 h
+1
em 7 dias
+1
em 15 dias
+2
em 1 mês
+2

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

EmailFilter: self-hosted email validation API

Free, open-source email verification and disposable email detection you run on your own server.
One small Go binary in a Docker image: no third-party API, no database, no tracking.

Release CI Go version License


EmailFilter is a free, open-source, self-hosted email validation API written in Go. Send it an email address and it answers with a score from 0 to 100 and a verdict, accepted or rejected, based on syntax, disposable email domains, MX records, an SMTP mailbox check, domain age, spam keywords, your own whitelist and blacklist, and the domain's reputation.

Use it to keep fake and throwaway addresses out of sign-up forms, to clean a mailing list before sending, or to reject mail from bad senders in Postfix, Proxmox Mail Gateway or Exim. It is a self-hosted alternative to paid email verification services such as ZeroBounce, NeverBounce and Kickbox: the addresses you check never leave your server.

It runs as one container with no database. Lists are plain text files, settings are environment variables, and over 100,000 disposable email domains are included and updated daily.

Try the live demo: the same Go code compiled to WebAssembly, running in your browser. The address never leaves the page; only the domain is looked up.

EmailFilter checking john.smith@gmail.com: accepted with a score of 70, with every check that made the score

A disposable address rejected in the dark theme, with the checks that were not needed skipped A list of eight addresses checked at once, with counts, verdicts, reasons and CSV downloads
Dark theme: a disposable address Bulk check of a whole list

Contents

Privacy

Email verification services see every address you send them. EmailFilter does the same checks on your own server.

  • No third-party API. The address is never sent to an outside service. The only outgoing connections are the ones the checks need: DNS for MX records, the domain's own mail servers for the SMTP check, and the domain registry (RDAP or WHOIS) for the registration date. The registry is only asked about the domain, never the address.
  • No mail is sent. The SMTP check stops after RCPT TO and never sends a message.
  • Nothing kept about people. Addresses are not saved to disk or logged at the default log level. Only per-domain counters are kept, for reputation.
  • No telemetry, no analytics, no calls home.
  • Safe outgoing connections. A domain cannot make EmailFilter connect to your internal network: private, loopback and link-local addresses are refused after DNS resolution.

Features

The nine checks EmailFilter runs, each shown as a card: disposable domains, mail servers, the mailbox, catch-all servers, domain age, syntax, gibberish and spam words, your own lists and reputation

Checks

  • Syntax check, including internationalized domains (ime@pošta.rs) and Unicode local parts
  • Disposable email detection against over 100,000 domains, subdomains included
  • MX lookup, with null MX (RFC 7505) handled
  • SMTP mailbox check: asks the mail servers, in priority order, whether the mailbox exists, without sending mail
  • Catch-all detection, so a server that accepts every address does not count as proof
  • Domain age from RDAP, with WHOIS as a fallback for TLDs without RDAP, to flag newly registered domains
  • Gibberish detection for local parts like xkcdqwrt
  • Spam keyword detection in the local part
  • Whitelist and blacklist of domains
  • Reputation: spam reports lower a domain's score

Running it

  • One static binary in a distroless image, running as a non-root user
  • No database: lists are text files, reputation is a JSON file saved every 30 seconds and on shutdown
  • Whitelist, blacklist and scoring changes apply immediately, no restart
  • List files changed on disk, for example by git pull, are reloaded within a minute
  • Optional daily download of the disposable domains list
  • API key, per-IP rate limiting and trusted proxy support
  • Caching of MX, SMTP and domain age results
  • Built-in Postfix policy service for Postfix and Proxmox Mail Gateway
  • Health check endpoint and Docker HEALTHCHECK
  • A browser demo and a bulk check of up to 1,000 addresses, running the same code compiled to WebAssembly

Benchmarks

EmailFilter and other open-source email validators

Smallest image, least memory, the fastest repeat checks, and the most labelled addresses judged right.

EmailFilter 2.0.1, Reacher (backend image latest), Truemail (rack image latest, truemail 3.3.0) and AfterShip email-verifier 1.5.0 ran side by side on the same server, each with its default settings, and checked the same addresses. The best value in each row is in bold.

EmailFilter 2.0.1 Reacher Truemail AfterShip email-verifier
Image unpacked 13.2 MB 999 MB 103 MB no official image¹
RAM at idle 11.5 MB 47 MB 29 MB 16.5 MB
RAM under load 25 MB 615 MB peak 51 MB peak 33 MB
Repeat checks, 10 at a time 19,952 req/s, p99 1.6 ms 4.3 req/s, p99 12.5 s 0.6 req/s, p99 31.9 s 1,436 req/s, p99 11.5 ms
First check of an address, median 494 ms 33 ms 499 ms 7 ms
Labelled addresses judged right 40 of 40 38 of 40 33 of 40 38 of 40
SMTP mailbox check yes yes yes no²
Catch-all detection yes yes no no²
Domain age yes no no no
Mail server integration Postfix policy service no no no

¹ Built from cmd/apiserver and run in a distroless image; the binary is 9.2 MB. ² The library can check SMTP, but its API server does not turn it on.

What each one got wrong: Reacher and AfterShip accepted both null MX domains (example.com, example.org), which take no mail. Truemail accepted 5 of the 10 disposable addresses, as it has no disposable list by default, and rejected two real domains whose mail servers did not answer its SMTP check. Reacher rejects addresses on disposable domains by reporting their syntax as invalid, which still counts as rejected here. AfterShip answers invalid syntax with a plain-text message and a domain that does not exist with HTTP 500; both count as rejected.

Why the speeds differ so much: EmailFilter caches MX, SMTP and domain age answers, so a repeat check of an address is answered from memory. Reacher and Truemail ask the mail server again on every check, so their load test was kept to 100 checks to protect the server's IP address from blocklists, and their numbers mostly measure the remote mail servers. AfterShip skips SMTP and domain age, which is why its first check is the fastest; EmailFilter's first check waits for the registry's RDAP or WHOIS answer.

How it was measured, on 30 November 2026: a shared 8-core VPS that also runs OpenPanel and other sites, so the numbers are a floor, not a lab result. Each tool ran as one container with podman: EmailFilter 2.0.1 from its published image (measured with the fix that became 2.0.1), the others from the images named above. The accuracy row checks 40 labelled addresses one at a time on fresh containers: 10 well-known disposable services, 3 domains that do not exist, 2 null MX domains, 5 invalid addresses and 20 postmaster@ addresses of real domains (RFC 5321 requires them to exist). The disposable domains are on EmailFilter's own list, so that row favours EmailFilter. The load row sends 5,000 checks of the 20 real addresses, 10 at a time (only 100 to Reacher and Truemail, which ask the mail server again on every check). The first check of an address waits for DNS, the mail server and the registry; four of the 40 mail servers did not answer and took the full 5 or 10 second SMTP timeout. The tool, the addresses and the raw answers are in bench.

Quick start

You need Docker with Docker Compose.

git clone https://github.com/stefanpejcic/EmailFilter emailfilter
cd emailfilter
docker compose up -d

EmailFilter is now on http://localhost:8000, reachable from this machine only. Check an address:

curl -X POST http://localhost:8000/filter-email \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]"}'

Settings are in .env. Before you make EmailFilter reachable from other machines, set an API key:

echo "EMAILFILTER_API_KEY=$(openssl rand -hex 32)" >> .env
docker compose up -d

Every request except /healthz then needs the key in an X-API-Key header (or Authorization: Bearer).

The container runs as user and group 1000 so it can write to ./lists, ./config and ./data. If those folders belong to another user, set EMAILFILTER_UID and EMAILFILTER_GID in .env.

Outgoing connections the checks need: port 53 for DNS, port 25 for the SMTP check, port 443 for RDAP and port 43 for WHOIS.

Checking an address

curl -X POST http://localhost:8000/filter-email \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]"}'
{
  "email": "[email protected]",
  "domain": "example.com",
  "disposable": false,
  "blacklisted": false,
  "whitelisted": false,
  "mx_exists": true,
  "mx_records": ["mx1.example.com", "mx2.example.com"],
  "gibberish": false,
  "smtp_valid": true,
  "catch_all": false,
  "new_domain": false,
  "domain_age_in_days": 10950,
  "spam_keywords": false,
  "reputation_penalty": 0,
  "score": 90,
  "verdict": "accepted"
}
Field Meaning
email, domain The address with the domain in lowercase ASCII form (punycode for internationalized domains).
disposable The domain or a parent domain is on the disposable list.
blacklisted, whitelisted The domain or a parent domain is on your blacklist or whitelist.
mx_exists, mx_records The domain has mail servers, listed by priority. mx_records is null when there are none.
gibberish The local part has five or more consonants in a row.
smtp_valid A mail server confirmed the mailbox exists. false when it does not, when the server could not be asked, or when the server is a catch-all.
catch_all The mail server accepts any address, so it cannot confirm this one.
new_domain, domain_age_in_days Days since the domain was registered, and whether that is under EMAILFILTER_NEW_DOMAIN_DAYS. null and false when the date is unknown.
spam_keywords The local part contains a word from lists/spam_keywords.txt.
reputation_penalty Points taken off for spam reports about the domain.
score, verdict The score from 0 to 100, and accepted when it is at least EMAILFILTER_ACCEPT_SCORE (60).
skipped Network checks left out because they could no longer change the verdict, such as ["mx", "smtp", "domain_age"] for a disposable domain. Only present when something was skipped; the score then counts only the checks that ran.

An address that is not valid syntax gets HTTP 422 with a detail message.

How the score works

Every address starts from base. Each check that applies adds or subtracts its weight, and the result is kept between 0 and 100.

Weight Built-in default In the shipped config/scores.json
base 50 50
mx_exists +20 +25
smtp_valid +20 +15
whitelisted +10 +50
new_domain −10 −10
disposable −60 −60
blacklisted −40 −50
gibberish −5 −5
spam_keywords −20 −40
reputation −50 −50

reputation is multiplied by the domain's spam reports per check, at most 1: a domain checked 10 times and reported 5 times loses 25 points.

Change weights with the API; they apply at once and are saved to config/scores.json. Keys you leave out keep their built-in default.

curl -X POST http://localhost:8000/scores \
  -H "Content-Type: application/json" \
  -d '{"gibberish": -15, "blacklisted": -100}'

API reference

GET / lists every endpoint and GET /help/<path> describes one, for example /help/filter-email.

Method and path Description
POST /filter-email Check an address. Body: {"email": "..."}.
POST /feedback/spam Report the domain of an address as spam. Body: {"email": "..."}.
POST /whitelist?domain=example.com Add a domain to the whitelist.
DELETE /whitelist?domain=example.com Remove a domain from the whitelist.
POST /blacklist?domain=example.com Add a domain to the blacklist.
DELETE /blacklist?domain=example.com Remove a domain from the blacklist.
GET /lists All lists.
GET /lists/{name} One list: whitelist, blacklist, disposable or spam_keywords.
DELETE /lists/{name} Empty a list.
GET /scores The weights in effect.
POST /scores Change weights.
POST /scores/default Restore the built-in weights.
GET /reputation/{domain} Checks, spam reports and current penalty of a domain.
DELETE /reputation/{domain} Forget a domain's checks and reports, for example after false reports.
GET /healthz Health check with the running version. Needs no API key.

A domain on the blacklist cannot be added to the whitelist, and the other way round, until it is removed. Errors are JSON with a detail message.

Configuration

All settings are environment variables, set in .env for Docker Compose. A wrong value stops EmailFilter at startup with a message naming the variable.

Variable Default Notes
EMAILFILTER_LISTEN :8000 Address and port to listen on.
EMAILFILTER_API_KEY Required on every endpoint except /healthz when set. At least 16 characters.
EMAILFILTER_RATE_LIMIT 120 Requests per minute per client IP. 0 turns it off.
EMAILFILTER_TRUST_PROXY Comma-separated IPs or CIDRs of reverse proxies allowed to set X-Forwarded-For.
EMAILFILTER_ACCEPT_SCORE 60 Lowest score that is accepted.
EMAILFILTER_CHECK_TIMEOUT 10s Longest time one check may take, network checks included.
EMAILFILTER_SMTP_CHECK true Ask mail servers whether the mailbox exists. Turn off where port 25 is blocked.
EMAILFILTER_SMTP_HELO hostname Name sent in EHLO. Use a name with matching reverse DNS.
EMAILFILTER_SMTP_FROM null sender <> Envelope sender of the SMTP check.
EMAILFILTER_SMTP_TIMEOUT 5s Per mail server.
EMAILFILTER_DOMAIN_AGE_CHECK true Look up the registration date with RDAP and WHOIS.
EMAILFILTER_NEW_DOMAIN_DAYS 30 A domain younger than this is new_domain.
EMAILFILTER_RECORD_CHECKS true Count checks per domain for reputation.
EMAILFILTER_REPUTATION_MAX 100000 Most domains kept in reputation; 0 is no limit.
EMAILFILTER_DISPOSABLE_URL Download the disposable domains list from this URL at startup and then periodically.
EMAILFILTER_DISPOSABLE_REFRESH 24h How often to download it.
EMAILFILTER_POLICY_LISTEN Address for the Postfix policy service, for example :10040. Off when empty.
EMAILFILTER_LISTS_DIR lists Folder with the list files.
EMAILFILTER_SCORES_FILE config/scores.json Custom weights.
EMAILFILTER_DATA_DIR data Folder for reputation.json.
EMAILFILTER_LOG_LEVEL info debug, info, warn or error.

The list files in lists/ have one entry per line; lines starting with # are ignored. disposable_domains.txt in this repository is updated every day from disposable-email-domains; git pull brings the new list and EmailFilter reloads it. Without a git checkout, set EMAILFILTER_DISPOSABLE_URL to that address instead.

Mail server integration

Postfix

EmailFilter includes a Postfix policy service, so Postfix can ask it about each sender with no scripts. Senders with the verdict rejected get 550 5.7.1 Sender address rejected by EmailFilter. If EmailFilter fails or is too slow, the mail is let through.

  1. Turn the service on in .env and publish the port in docker-compose.yml (uncomment the 10040 line):

    EMAILFILTER_POLICY_LISTEN=:10040
    
  2. Add it to /etc/postfix/main.cf, after reject_unauth_destination:

    smtpd_recipient_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_unauth_destination,
        check_policy_service { inet:127.0.0.1:10040, timeout=10s, default_action=DUNNO }
    
  3. postfix reload

Your own users are let through by permit_mynetworks and permit_sasl_authenticated before EmailFilter is asked. Bounces, which have an empty sender, are always let through. The policy port has no authentication, so keep it on localhost or a private network.

Proxmox Mail Gateway

Proxmox Mail Gateway is built on Postfix and uses the same policy service. PMG writes main.cf from a template, so the change goes in a custom template:

mkdir -p /etc/pmg/templates
cp /var/lib/pmg/templates/main.cf.in /etc/pmg/templates/

In /etc/pmg/templates/main.cf.in, add check_policy_service { inet:127.0.0.1:10040, timeout=10s, default_action=DUNNO } to smtpd_recipient_restrictions after reject_unauth_destination, then apply it:

pmgconfig sync --restart 1

Exim

Copy scripts/emailfilter-check.sh to /usr/local/bin/ and make it executable. It needs curl and jq, exits 1 for a rejected address and lets mail through when EmailFilter cannot be reached. Then add this near the top of acl_check_rcpt:

  deny
    !senders = :
    !hosts = +relay_from_hosts
    condition = ${if eq{${run{/usr/local/bin/emailfilter-check.sh $sender_address}{ok}{rejected}}}{rejected}}
    message = Sender address rejected by EmailFilter

With an API key or another address, set EMAILFILTER_API_KEY and EMAILFILTER_URL (default http://127.0.0.1:8000) in the environment Exim runs commands with.

Updating

git pull
docker compose pull
docker compose up -d

Images are published to ghcr.io/stefanpejcic/emailfilter for linux/amd64 and linux/arm64, signed with cosign, with an SBOM and build provenance. The tag stable follows the latest release; pin an exact version such as 2.0.0 in production. GET /healthz reports the running version.

Troubleshooting

  • smtp_valid is always false. Most cloud and home networks block outgoing port 25. Test with telnet gmail-smtp-in.l.google.com 25. If it is blocked, set EMAILFILTER_SMTP_CHECK=false and the score relies on the other checks. Large providers also refuse checks from servers without reverse DNS, so set EMAILFILTER_SMTP_HELO to a name that matches it.
  • domain_age_in_days is always null. Outgoing ports 443 (RDAP) and 43 (WHOIS) must be open. Some registries publish no creation date at all.
  • curl: (52) Empty reply from server or connection refused. Check docker logs emailfilter; a wrong setting is reported there by name.
  • 401 Unauthorized. EMAILFILTER_API_KEY is set; send it in the X-API-Key header.
  • Every request counts against one IP behind a reverse proxy. Set EMAILFILTER_TRUST_PROXY to the proxy's address.
  • permission denied saving a list. The folders must belong to EMAILFILTER_UID:EMAILFILTER_GID (default 1000).

Development

go test -race ./...
go run ./cmd/emailfilter

The code is in internal/: checks (MX, SMTP, RDAP and WHOIS), lists, reputation, scores, filter (the score), httpapi and policy (the Postfix policy service). It has one dependency outside the Go standard library, golang.org/x/net/idna. CI runs gofmt, go vet, golangci-lint, the tests with the race detector, govulncheck, a Trivy scan of the image and a smoke test of the container.

The website, documentation and demo live in site/: pages in site/pages, the documentation as Markdown in site/docs, and a small Go program that builds them and checks every link. cmd/wasm is EmailFilter compiled to WebAssembly for the demo, with MX records from DNS-over-HTTPS and the domain age from RDAP (internal/webnet); browsers cannot do the SMTP or WHOIS checks. Build and preview it with:

SITE_URL=http://localhost:8080/ ./scripts/build-site.sh
python3 -m http.server -d _site 8080

The 1200×630 social previews in site/og are drawn from a built site with node scripts/og.cjs _site, and the README screenshots in assets/screenshots with SITE=http://localhost:8080 node scripts/screenshots.cjs while the site is served (both need Playwright). Run them again after changing the pages and commit the images.

EmailFilter follows semantic versioning. VERSION holds the next release.

FAQ

What is EmailFilter? A self-hosted email validation API. You send it an email address over HTTP and it tells you whether the address looks real and deliverable, with a score from 0 to 100 and a verdict.

Is EmailFilter free? Yes. It is open source under the MIT license, with no paid edition, no usage limits and no telemetry.

Does it send the addresses I check to anyone? No. There is no third-party API. EmailFilter talks to DNS, to the domain's own mail servers for the SMTP check and to the domain's registry for its age, and the registry only sees the domain.

How does it detect disposable email addresses? It matches the domain and its parent domains against a list of over 100,000 disposable and temporary email domains, updated daily, and checks for signs like a newly registered domain or a catch-all mail server.

Does the SMTP check send an email? No. It connects to the domain's mail server and asks whether it would accept mail for the address (RCPT TO), then disconnects before any message is sent.

Why is smtp_valid false for an address that exists? Usually because outgoing port 25 is blocked, the mail server is a catch-all, or the provider refuses checks from servers without proper reverse DNS. See Troubleshooting.

Can I use it with Postfix, Proxmox Mail Gateway or Exim? Yes. Postfix and Proxmox Mail Gateway use the built-in policy service; Exim uses a small script.

Is it an alternative to ZeroBounce, NeverBounce or Kickbox? For the checks it does, yes, and it runs on your own server with no per-check fees. Those services also use large shared datasets about known spam traps and abuse that a self-hosted tool does not have.

Does it need a database? No. Lists are text files and reputation is a JSON file.

License

MIT. See LICENSE.

Explore projetos relacionados

Carregando…