checkmail

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 7 Imported by: 1

README

checkmail

Godoc Reference Coverage Go Report Card

checkmail is a simple go package to check the validity of an email, it can check:

  • Format
  • Domain validity
  • Mailbox existance, by checking the user and mailbox host

Install

go get -u github.com/loopcontext/checkmail

Example

Check email format
email := "email@email.com"
err := ValidateFormat(email)
if err != nil {
    fmt.Printf(`"%s" -> format error: %q`, mail, err)
}
// Send email ...
Check the host and email existance
email := "email@email.com"
err := ValidateHost(email)
if err != nil {
    fmt.Printf(`"%s" -> host error: %q`, mail, err)
}
// Send email ...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadFormat        = errors.New("invalid format")
	ErrUnresolvableHost = errors.New("unresolvable host")
)

Error vars

Functions

func ValidateFormat

func ValidateFormat(email string) error

ValidateFormat validates email format

func ValidateHost

func ValidateHost(email string) error

ValidateHost validates host

Types

type STMPError

type STMPError struct {
	Err error
}

STMPError describes an error from the SMTP server

func NewSMTPError

func NewSMTPError(err error) STMPError

NewSMTPError creates a new STMPError instance

func (STMPError) Code

func (e STMPError) Code() string

Code Status code

func (STMPError) Error

func (e STMPError) Error() string

Jump to

Keyboard shortcuts

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