Documentation ¶
Index ¶
- Constants
- func GenerateRandomEmail(domain string) string
- func IsAddressValid(email string) bool
- type Gravatar
- type LookupError
- type Mx
- type Result
- type SMTP
- type Syntax
- type Verifier
- func (v *Verifier) AddDisposableDomains(domains []string) *Verifier
- func (v *Verifier) CheckGravatar(email string) (*Gravatar, error)
- func (v *Verifier) CheckMX(domain string) (*Mx, error)
- func (v *Verifier) CheckSMTP(domain, username string) (*SMTP, error)
- func (v *Verifier) DisableAutoUpdateDisposable() *Verifier
- func (v *Verifier) DisableDomainSuggest() *Verifier
- func (v *Verifier) DisableGravatarCheck() *Verifier
- func (v *Verifier) DisableSMTPCheck() *Verifier
- func (v *Verifier) EnableAutoUpdateDisposable() *Verifier
- func (v *Verifier) EnableDomainSuggest() *Verifier
- func (v *Verifier) EnableGravatarCheck() *Verifier
- func (v *Verifier) EnableSMTPCheck() *Verifier
- func (v *Verifier) FromEmail(email string) *Verifier
- func (v *Verifier) HelloName(domain string) *Verifier
- func (v *Verifier) IsDisposable(domain string) bool
- func (v *Verifier) IsFreeDomain(domain string) bool
- func (v *Verifier) IsRoleAccount(username string) bool
- func (v *Verifier) ParseAddress(email string) Syntax
- func (v *Verifier) Proxy(proxyURI string) *Verifier
- func (v *Verifier) SuggestDomain(domain string) string
- func (v *Verifier) Verify(email string) (*Result, error)
Constants ¶
const ( // Standard Errors ErrTimeout = "The connection to the mail server has timed out" ErrNoSuchHost = "Mail server does not exist" ErrBlocked = "Blocked by mail server" // RCPT Errors ErrTryAgainLater = "Try again later" ErrFullInbox = "Recipient out of disk space" ErrTooManyRCPT = "Too many recipients" ErrNoRelay = "Not an open relay" ErrMailboxBusy = "Mailbox busy" ErrExceededMessagingLimits = "Messaging limits have been exceeded" ErrNotAllowed = "Not Allowed" ErrNeedMAILBeforeRCPT = "Need MAIL before RCPT" ErrRCPTHasMoved = "Recipient has moved" )
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomEmail ¶
Generates a random email address using the domain passed Used primarily for checking the existence of a catch-all address
func IsAddressValid ¶
Checks if email address is formatted correctly by using regex
Types ¶
type Gravatar ¶
type Gravatar struct { HasGravatar bool // Whether has gravatar GravatarUrl string // Gravatar url }
Detail about the Gravatar
type LookupError ¶
type LookupError struct { Message string `json:"message" xml:"message"` Details string `json:"details" xml:"details"` }
MX dns records lookup error
func ParseSMTPError ¶
func ParseSMTPError(err error) *LookupError
Receives MX Servers response message and generates the corresponding MX error
func (*LookupError) Error ¶
func (e *LookupError) Error() string
type Mx ¶
type Mx struct { HasMXRecord bool // Whether has 1 or more MX record Records []*net.MX // Represent DNS MX records }
Detail about the Mx host
type Result ¶
type Result struct { Email string `json:"email"` // Passed email address Reachable string `json:"reachable"` // Enumeration to describe whether the recipient's address is real Syntax Syntax `json:"syntax"` // Details about the email address syntax SMTP *SMTP `json:"smtp"` // Details about the SMTP response of the email Gravatar *Gravatar `json:"gravatar"` // Whether there is a gravatar for email Suggestion string `json:"suggestion"` // Suggesting a domain when the domain is misspelled Disposable bool `json:"disposable"` // Disposable email address RoleAccount bool `json:"role_account"` // Is the account role-based Free bool `json:"free"` // Is domain a free email domain HasMxRecords bool `json:"has_mx_records"` // Whether MX-Records for the domain }
Result of Email Verification
type SMTP ¶
type SMTP struct { HostExists bool `json:"host_exists"` // Is the host exists FullInbox bool `json:"full_inbox"` // Is the email account's inbox full CatchAll bool `json:"catch_all"` // Does the domain have a catch-all email address Deliverable bool `json:"deliverable"` // Can email the email server Disabled bool `json:"disabled"` // Is the email blocked or disabled by the provider }
Stores all information for SMTP verification lookup
type Syntax ¶
type Syntax struct { Username string `json:"username"` Domain string `json:"domain"` Valid bool `json:"valid"` }
Stores all information about an email Syntax
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Email verifier Create one by calling NewVerifier
func (*Verifier) AddDisposableDomains ¶
Adds additional domains as disposable domains
func (*Verifier) CheckGravatar ¶
Returns the Gravatar records for the given email
func (*Verifier) CheckSMTP ¶
Performs an email verification on the passed domain via SMTP
- the domain is the passed email domain
- username is used to check the deliverability of specific email address
if server is catch-all server, username will not be checked
func (*Verifier) DisableAutoUpdateDisposable ¶
Stops previously started schedule job
func (*Verifier) DisableDomainSuggest ¶
Will not suggest anything
func (*Verifier) DisableGravatarCheck ¶
Disables check gravatar
func (*Verifier) DisableSMTPCheck ¶
Disables check email by smtp
func (*Verifier) EnableAutoUpdateDisposable ¶
Enables update disposable domains automatically
func (*Verifier) EnableDomainSuggest ¶
Will uggest a most similar correct domain when domain misspelled
func (*Verifier) EnableGravatarCheck ¶
Enables check gravatar, we don't check gravatar by default
func (*Verifier) EnableSMTPCheck ¶
Enables check email by smtp, for most ISPs block outgoing SMTP requests through port 25, to prevent spam, we don't check smtp by default
func (*Verifier) IsDisposable ¶
Checks if the domain is disposable
func (*Verifier) IsFreeDomain ¶
Checks if the domain is free
func (*Verifier) IsRoleAccount ¶
Checks if username is a role-based account
func (*Verifier) ParseAddress ¶
Attempts to parse an email address and return it in the form of a Syntax
func (*Verifier) Proxy ¶
Sets a SOCKS5 proxy to verify the email, proxyURI should be in the format: "socks5://user:password@127.0.0.1:1080?timeout=5s". The protocol could be socks5, socks4 and socks4a.
func (*Verifier) SuggestDomain ¶
Checks if domain has a typo and suggests a similar correct domain from metadata, returns a suggestion