Documentation
¶
Overview ¶
Package email validates and normalizes email addresses for storage and comparison.
Index ¶
Constants ¶
const StrictParserError = errStr("email does not meet StrictParser requirements")
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NormalizeOption ¶
type NormalizeOption func(*normalizeConfig)
NormalizeOption configures optional normalization behavior.
func StripPlusTag ¶
func StripPlusTag() NormalizeOption
StripPlusTag removes everything after the first "+" in the local part during normalization.
type ValidAddress ¶
type ValidAddress string
ValidAddress is an email address that has already passed package validation.
It exists so Normalize can be limited to addresses returned by the package parsers instead of arbitrary strings.
func StrictParser ¶
func StrictParser(email string) (valid *ValidAddress, err error)
StrictParser trims surrounding whitespace and validates the address against the package's strict rules.
func (*ValidAddress) Address ¶
func (v *ValidAddress) Address() string
func (*ValidAddress) IsBlacklisted ¶
func (v *ValidAddress) IsBlacklisted(blacklists ...[]string) bool
IsBlacklisted reports whether the receiver's domain matches any blacklist entry. When no custom blacklist is provided, it falls back to DefaultBlacklist.
func (*ValidAddress) Normalize ¶
func (v *ValidAddress) Normalize(options ...NormalizeOption)
Normalize canonicalizes the receiver for storage and comparison.
Apply the same normalization anywhere the address is stored, matched, or used for verification so those operations stay consistent.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package blacklist loads blacklisted domains into memory.
|
Package blacklist loads blacklisted domains into memory. |
|
examples
|
|
|
message
command
|
|
|
smtp
command
|
|
|
validation
command
|
|
|
Package mailer defines messages and delivery interfaces for email backends.
|
Package mailer defines messages and delivery interfaces for email backends. |
|
backends/smtp
Package smtp sends mail through SMTP.
|
Package smtp sends mail through SMTP. |
|
backends/mailgun
module
|