AfterShip / email-verifier

:white_check_mark: A Go library for email verification without sending any emails.
MIT License
1.22k stars 157 forks source link

how can i do smtp check with general validation? #53

Closed civil-dude closed 3 years ago

civil-dude commented 3 years ago

I need result like this format { "email": "tuyensinh@ued.udn.vn", "disposable": false, "reachable": "unknown", "role_account": false, "free": false, "syntax": { "username": "tuyensinh", "domain": "ued.udn.vn", "valid": true }, "has_mx_records": true, "smtp": { "host_exists": true, "full_inbox": false, "catch_all": true, "deliverable": false, "disabled": false }, "gravatar": null, "suggestion": "" }

lryong commented 3 years ago

@civil-dude The README provides a detailed example, you need enable SMTP check when initialize a verifier:

var (
    verifier = emailverifier.
        NewVerifier().
        EnableSMTPCheck()
)

func main() {

    domain := "domain.org"
    username := "username"
    ret, err := verifier.CheckSMTP(domain, username)
    if err != nil {
        fmt.Println("check smtp failed: ", err)
        return
    }

    fmt.Println("smtp validation result: ", ret)

}
civil-dude commented 3 years ago

what is meaning of disabled in smtp checking result. disable : {"host_exists":true,"full_inbox": false,"catch_all":true,"deliverable":false,"disabled":true}

lryong commented 3 years ago

what is meaning of disabled in smtp checking result. disable : {"host_exists":true,"full_inbox": false,"catch_all":true,"deliverable":false,"disabled":true}

https://github.com/AfterShip/email-verifier/blob/v1.3.0/smtp.go#L16

civil-dude commented 3 years ago

how can i check both smtp and verifier.Verify in one function?

lryong commented 3 years ago

just need to initialize verifier with EnableSMTPCheck() once, maybe you can read examples from REAME and unit testes, it will help you a lot~