Documentation
¶
Overview ¶
Package emailguard provides fast, practical heuristics for validating business email domains during user signup.
It filters out disposable, masked, or misconfigured email domains by combining lightweight DNS inspection (MX lookups) with a curated blocklist of known temporary email providers.
Key behaviors:
- Auto-clones and updates the public disposable-email-domains list
- Checks for valid MX records with a short timeout
- Caches DNS and verdict results for low latency
- Rejects domains or MX hosts matching disposable or masking patterns
- Allows configurable consumer-domain allowlist (e.g. Gmail, Outlook)
This package is optimized for B2B SaaS signup flows where verifying the authenticity of an email domain matters more than tolerating edge cases in personal mail services.
Example usage:
import "yourproject/emailguard"
ok := emailguard.IsLegitEmail("user@company.com")
if !ok {
fmt.Println("reject: unverified or disposable domain")
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLegitEmail ¶
IsLegitEmail returns true only if the domain looks like a legit mailbox domain (no MX => reject, disposable => reject, masking MX => reject).
func LoadTempMails ¶
func LoadTempMails() map[string]struct{}
LoadTempMails clones or pulls the disposable list and returns a set of domains. Safe to call multiple times; work is done once per process.
Types ¶
This section is empty.