emailaddr

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package emailaddr checks and classifies email addresses for the audience and the importer: syntax, role addresses, disposable domains, likely typos, spam-trap-like patterns, mailbox providers and masking.

Index

Constants

View Source
const (
	ProblemNoDomain     = "no domain"
	ProblemDoubleDot    = "double dot"
	ProblemNotAnAddress = "not an address"
	ProblemTooLong      = "too long"
)

Problems returned by Check. They are short phrases shown next to the raw value in import previews and reports.

View Source
const (
	Gmail   = "gmail"
	Outlook = "outlook"
	Yahoo   = "yahoo"
	ICloud  = "icloud"
	Other   = "other"
)

Mailbox providers, in the order the charts use.

View Source
const (
	HostGoogleWorkspace = "Google Workspace"
	HostMicrosoft365    = "Microsoft 365"
	HostOutlookCom      = "Outlook.com"
	HostYahoo           = "Yahoo Mail"
	HostICloud          = "iCloud Mail"
)

Hosting names of company domains whose mail a mailbox provider filters.

Variables

View Source
var MailboxProviders = []string{Gmail, Outlook, Yahoo, ICloud, Other}

MailboxProviders lists the keys in chart order.

Functions

func Check

func Check(s string) (string, string)

Check normalizes s and reports why it isn't a deliverable address, or "" when the syntax is fine. It does not look up DNS.

func Domain

func Domain(email string) string

Domain returns the part after the @, lower-cased.

func HostingFromMX

func HostingFromMX(host string) string

HostingFromMX names the hosting of a domain from one of its MX hosts: "Google Workspace", "Microsoft 365", "Fastmail", "Proton", "Zoho Mail". A host counts only when it is the provider's domain or one of its subdomains: anyone can name their MX mx.evilgoogle.com or mx.xyahoodns.net, and their domain must not pass for Gmail's or Yahoo's.

func IsDisposable

func IsDisposable(domain string) bool

IsDisposable reports whether domain belongs to a temporary-inbox service.

func IsRole

func IsRole(email string) bool

IsRole reports whether the address is a role address (info@, sales@…).

func Local

func Local(email string) string

Local returns the part before the @.

func MailboxKey

func MailboxKey(email string) string

MailboxKey folds the addresses that reach the same mailbox: it normalizes the address, drops a plus tag and the dots of a Gmail address, and reads googlemail.com as gmail.com. Sam.Rivera+news@gmail.com and samrivera@googlemail.com give the same key.

func MailboxName

func MailboxName(key string) string

MailboxName is the display name of a mailbox provider key.

func MailboxProvider

func MailboxProvider(domain string) string

MailboxProvider classifies a consumer domain into the mailbox provider that filters its mail. Company domains hosted by a mailbox provider (Google Workspace, Microsoft 365) stay "other" here; internal/mailbox classifies them from their MX records (see HostingFromMX).

func Mask

func Mask(email string) string

Mask hides most of the local part: "r.walker@outlook.com" → "r.w···@outlook.com".

func Normalize

func Normalize(s string) string

Normalize trims spaces and angle brackets and lower-cases the address.

func TrapLike

func TrapLike(email string) bool

TrapLike reports addresses that look like spam traps: honeypot local parts and catch-all scraper patterns. HostRepute knows real trap networks; this is the offline heuristic.

func TypoFix

func TypoFix(domain string) (string, bool)

TypoFix returns the intended domain when domain is one edit (insertion, deletion, substitution or swap of neighbours) away from a major provider.

func Valid

func Valid(s string) bool

Valid reports whether s is a syntactically valid address.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL