email

package module
v2.4.52 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package email is a simple email validation package. Package valids email address string to RFC requirements and performs a DNS lookup for the MX records using the local DNS settings.

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidFormat is an error generatd when the format is incorrect
	ErrInvalidFormat = errors.New("Invalid email format")

	//ErrInvalidDomainNoNameServers is an error generatd when the domain returns no Name Server reocrds
	ErrInvalidDomainNoNameServers = errors.New("Invalid email domain, unable to find Name Servers records")

	//ErrInvalidDomainNoMXRecords is an error generatd when the domain returns no MX reocrds
	ErrInvalidDomainNoMXRecords = errors.New("Invalid email domain no MX records found")
)

Functions

func Normalize

func Normalize(email string) string

Normalize - Trim whitespaces, extra dots in the hostname and converts to Lowercase.

func Split

func Split(email string) (username string, domain string)

Split - Splits an email address into a username prefix and domain

func Validate

func Validate(email string) error

Validate - validates an email address via all options

func ValidateDomainRecords

func ValidateDomainRecords(email string) error

ValidateDomainRecords - validates an email address domain's NS and MX records via a DNS lookup

func ValidateFormat

func ValidateFormat(email string) error

ValidateFormat - validates an email address meets rfc 822 format via a regex

Types

This section is empty.

Jump to

Keyboard shortcuts

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