verifier

package
v0.0.0-...-4112a1c Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUnexpectedResponse = "Unexpected response from deliverabler"

	// Standard Errors
	ErrTimeout           = "The connection to the mail server has timed out"
	ErrNoSuchHost        = "Mail server does not exist"
	ErrServerUnavailable = "Mail server is unavailable"
	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

This section is empty.

Types

type Address

type Address struct {
	Address  string `json:"address" xml:"address"`
	Username string `json:"username" xml:"username"`
	Domain   string `json:"domain" xml:"domain"`
	MD5Hash  string `json:"md5Hash" xml:"md5Hash"`
}

Address stores all information about an email Address

func ParseAddress

func ParseAddress(email string) (*Address, error)

ParseAddress attempts to parse an email address and return it in the form of an Address struct pointer - domain case insensitive

type Deliverabler

type Deliverabler struct {
	// contains filtered or unexported fields
}

Deliverabler contains the context and smtp.Client needed to check email address deliverability

func NewDeliverabler

func NewDeliverabler(domain, hostname, sourceAddr string) (*Deliverabler, error)

NewDeliverabler generates a new Deliverabler reference

func (*Deliverabler) Close

func (d *Deliverabler) Close()

Close closes the Deliverablers SMTP client connection

func (*Deliverabler) HasCatchAll

func (d *Deliverabler) HasCatchAll(retry int) bool

HasCatchAll checks the deliverability of a randomly generated address in order to verify the existence of a catch-all

func (*Deliverabler) IsDeliverable

func (d *Deliverabler) IsDeliverable(email string, retry int) error

IsDeliverable takes an email address and performs the operation of adding the email to the envelope. It also receives a number of retries to reconnect to the MX server before erring out. If a 250 is received the email is valid

type Disposabler

type Disposabler struct {
	// contains filtered or unexported fields
}

Disposabler contains the map of known disposable email domains

func NewDisposabler

func NewDisposabler(client *httpclient.Client) *Disposabler

NewDisposabler creates a new Disposabler and starts a domain farmer that retrieves all known disposable domains periodically

func (*Disposabler) IsDisposable

func (d *Disposabler) IsDisposable(domain string) bool

IsDisposable tests whether a string is among the known set of disposable mailbox domains. Returns true if the address is disposable

type Free

type Free struct {
	// contains filtered or unexported fields
}

Free contains the map of known free email domains

func NewFree

func NewFree(client *httpclient.Client) *Free

NewFree creates a new Free and starts a domain farmer that retrieves all known free domains periodically

func (*Free) IsFree

func (d *Free) IsFree(domain string) bool

IsFree tests whether a string is among the known set of free mailbox domains. Returns true if the address is free

type Lookup

type Lookup struct {
	XMLName xml.Name `json:"-" xml:"lookup"`
	Address
	ValidFormat bool `json:"validFormat" xml:"validFormat"`
	Deliverable bool `json:"deliverable" xml:"deliverable"`
	FullInbox   bool `json:"fullInbox" xml:"fullInbox"`
	HostExists  bool `json:"hostExists" xml:"hostExists"`
	CatchAll    bool `json:"catchAll" xml:"catchAll"`
	Disposable  bool `json:"disposable" xml:"disposable"`
	Gravatar    bool `json:"gravatar" xml:"gravatar"`
	Free        bool `json:"free" xml:"free"`
	Role        bool `json:"role" xml:"role"`
}

Lookup contains all output data for an email verification Lookup

type LookupError

type LookupError struct {
	Message string `json:"message" json:"message"`
	Details string `json:"details" json:"details"`
}

LookupError is an error

func (*LookupError) Error

func (e *LookupError) Error() string

Error satisfies the error interface

type Role

type Role struct {
	// contains filtered or unexported fields
}

Role contains the map of known role users emails

func NewRole

func NewRole(client *httpclient.Client) *Role

NewRole creates a new Role and starts a domain farmer that retrieves all known role users emails periodically

func (*Role) IsRole

func (d *Role) IsRole(username string) bool

IsRole tests whether a string is among the known set of roles users emails. Returns true if the address is role

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

Verifier contains all dependencies needed to perform educated email verification lookups

func NewVerifier

func NewVerifier(hostname, sourceAddr string) *Verifier

NewVerifier generates a new httpclient.Client using the passed timeout and then returns a new Verifier reference that will be used to Verify email addresses

func (*Verifier) Blacklisted

func (v *Verifier) Blacklisted() error

Blacklisted is a parent blacklist checking method that returns true if our IP is blacklisted in any of the monitored blacklisting services

func (*Verifier) HasGravatar

func (v *Verifier) HasGravatar(md5Hash string) bool

HasGravatar performs an http HEAD request to check if the email is associated with a gravatar account

func (*Verifier) Verify

func (v *Verifier) Verify(email string) (*Lookup, error)

Verify performs an email verification on the passed email address

func (*Verifier) VerifyTimeout

func (v *Verifier) VerifyTimeout(email string, timeout time.Duration) (*Lookup, error)

VerifyTimeout performs an email verification, failing with an ErrTimeout if a valid Lookup isn't produced within the timeout passed

Jump to

Keyboard shortcuts

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