Fast, practical heuristics for validating business email domains during signup.
emailguard filters out disposable, masked, or misconfigured email domains using lightweight DNS inspection and a curated blocklist of known temporary email providers.
It’s designed for B2B SaaS signup flows where you want real business emails, not throwaway addresses.
- ✅ Checks MX records (fast, 1s timeout)
- ✅ Blocks disposable & temp-mail domains (auto-syncs from GitHub)
- ✅ Detects masking/aliasing services via MX heuristics
- ✅ Caches verdicts and DNS results in memory
- ✅ Safe defaults for consumer providers (Gmail, Outlook, etc.)
- ✅ Zero external services — pure Go + DNS
go get github.com/vandit1604/emailguardpackage main
import (
"fmt"
"github.com/vandit1604/emailguard"
)
func main() {
ok := emailguard.IsLegitEmail("user@company.com")
if !ok {
fmt.Println("Reject: unverified or disposable domain")
} else {
fmt.Println("Looks good ✅")
}
}Output:
Looks good ✅
or, for a disposable domain:
Reject: unverified or disposable domain
-
Clones disposable-email-domains into
/tmp(once per process). -
Checks:
- Is domain in blocklist?
- Has valid MX?
- Does MX contain masking keywords? (
mask,relay,forward,tempmail, etc.) - Are MX registrable domains disposable?
-
Caches DNS + verdicts for 5 minutes.
-
Returns a simple boolean — fast, deterministic, low overhead.
Modify allowlist, mxBadKeywords, or cache TTLs inside the package if needed.
- Block signups using temp or masked emails
- Improve lead quality in B2B products
- Sanitize marketing imports
- Gate API access behind legit company addresses
MIT — free for commercial use. Attribution appreciated but not required.