Content-Length: 280893 | pFad | http://github.com/badoux/checkmail

62 GitHub - badoux/checkmail: Golang package for email validation
Skip to content

badoux/checkmail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

checkmail

Golang package for email validation.

GoDoc

Usage

Install the Checkmail package

go get github.com/badoux/checkmail

1. Format

func main() {
    err := checkmail.ValidateFormat("ç$€§/az@gmail.com")
    if err != nil {
        fmt.Println(err)
    }
}

output: invalid format

2. Domain

func main() {
    err := checkmail.ValidateHost("email@x-unkown-domain.com")
    if err != nil {
        fmt.Println(err)
    }
}

output: unresolvable host

3. Host and User

If host is valid, requires valid SMTP serverHostName (see to online validator) and serverMailAddress to reverse validation for prevent SPAN and BOTS.

func main() {
    var (
        serverHostName    = "smtp.myserver.com" // set your SMTP server here
        serverMailAddress = "validuser@myserver.com"  // set your valid mail address here
    )
    err := checkmail.ValidateHostAndUser(serverHostName, serverMailAddress, "unknown-user-129083726@gmail.com")
    if smtpErr, ok := err.(checkmail.SmtpError); ok && err != nil {
        fmt.Printf("Code: %s, Msg: %s", smtpErr.Code(), smtpErr)
    }
}

output: Code: 550, Msg: 550 5.1.1 The email account that you tried to reach does not exist.

License

Checkmail is licensed under the MIT License.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/badoux/checkmail

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy