verifier

package
v0.0.0-...-5bf27f7 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: BSD-3-Clause Imports: 13 Imported by: 38

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

View Source
var ErrNoAtChar = errors.New("No '@' character found on email address")

ErrNoAtChar is thrown when no '@' character is found on an email address

Functions

This section is empty.

Types

type Address

type Address struct{ Address, Username, Domain, MD5Hash string }

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 Lookup

type Lookup struct {
	Address
	ValidFormat, Deliverable, FullInbox, HostExists, CatchAll bool
}

Lookup contains all output data for an email verification Lookup

type LookupError

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

LookupError is an error

func ParseSMTPError

func ParseSMTPError(err error) *LookupError

ParseSMTPError receives an MX Servers response message and generates the cooresponding MX error

func (*LookupError) Error

func (e *LookupError) Error() string

Error satisfies the error interface

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 Verifier using the passed hostname and source email address

func (*Verifier) Verify

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

Verify performs an email verification on the passed email address

Jump to

Keyboard shortcuts

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