MCPcopy Index your code
hub / github.com/badoux/checkmail

github.com/badoux/checkmail @v1.2.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.4 ↗ · + Follow
15 symbols 33 edges 2 files 4 documented · 27% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

checkmail

Golang package for email validation.

  • Format (simple regexp, see: https://www.w3.org/TR/html5/forms.html#valid-e-mail-address and https://davidcel.is/posts/stop-validating-email-addresses-with-regex/)
  • Valid domain
  • Valid user: verify if the user and mailbox really exist

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.

Core symbols most depended-on inside this repo

Shape

Function 12
Method 2
Struct 1

Languages

Go100%

Modules by API surface

checkmail.go10 symbols
checkmail_test.go5 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add checkmail \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page