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) 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) DisableGravatarCheck() *Verifier
- func (v *Verifier) DisableSMTPCheck() *Verifier
- func (v *Verifier) EnableAutoUpdateDisposable() *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) 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 ΒΆ
GenerateRandomEmail generates a random email address using the domain passed. Used primarily for checking the existence of a catch-all address
func IsAddressValid ΒΆ
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 }
Gravatar is detail about the Gravatar
type LookupError ΒΆ
type LookupError struct { Message string `json:"message" xml:"message"` Details string `json:"details" xml:"details"` }
LookupError is an MX dns records lookup error
func ParseSMTPError ΒΆ
func ParseSMTPError(err error) *LookupError
ParseSMTPError receives an 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 }
Mx is detail about the Mx host
type Result ΒΆ
type Result struct { Email string `json:"email"` // passed email address Disposable bool `json:"disposable"` // is this a DEA (disposable email address) Reachable string `json:"reachable"` // an enumeration to describe whether the recipient address is real RoleAccount bool `json:"role_account"` // is account a role-based account Free bool `json:"free"` // is domain a free email domain Syntax *Syntax `json:"syntax"` // details about the email address syntax HasMxRecords bool `json:"has_mx_records"` // whether or not MX-Records for the domain SMTP *SMTP `json:"smtp"` // details about the SMTP response of the email Gravatar *Gravatar `json:"gravatar"` // whether or not have gravatar for the email }
Result is the 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 send an email to the email server? Disabled bool `json:"disabled"` // is the email blocked or disabled by the provider? }
SMTP stores all information for SMTP verification lookup
type Syntax ΒΆ
type Syntax struct { Username string `json:"username"` Domain string `json:"domain"` Valid bool `json:"valid"` }
Syntax stores all information about an email Syntax
type Verifier ΒΆ
type Verifier struct {
// contains filtered or unexported fields
}
Verifier is an email verifier. Create one by calling NewVerifier
func (*Verifier) CheckGravatar ΒΆ
CheckGravatar will return the Gravatar records for the given email.
func (*Verifier) CheckMX ΒΆ
CheckMX will return the DNS MX records for the given domain name sorted by preference.
func (*Verifier) CheckSMTP ΒΆ
CheckSMTP performs an email verification on the passed domain via SMTP
func (*Verifier) DisableAutoUpdateDisposable ΒΆ
DisableAutoUpdateDisposable stops previously started schedule job
func (*Verifier) DisableGravatarCheck ΒΆ
DisableGravatarCheck disables check gravatar,
func (*Verifier) DisableSMTPCheck ΒΆ
DisableSMTPCheck disables check email by smtp
func (*Verifier) EnableAutoUpdateDisposable ΒΆ
EnableAutoUpdateDisposable enables update disposable domains automatically
func (*Verifier) EnableGravatarCheck ΒΆ
EnableGravatarCheck enables check gravatar, we don't check gravatar by default
func (*Verifier) EnableSMTPCheck ΒΆ
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 ΒΆ
IsDisposable checks if domain is a disposable domain
func (*Verifier) IsFreeDomain ΒΆ
IsFreeDomain checks if domain is a free domain
func (*Verifier) IsRoleAccount ΒΆ
IsRoleAccount checks if username is a role-based account
func (*Verifier) ParseAddress ΒΆ
ParseAddress attempts to parse an email address and return it in the form of an Syntax