AfterShip / email-verifier

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

Suggestion working differently in Verify and SuggestDomain functions #101

Open mardu opened 1 year ago

mardu commented 1 year ago
package main

import (
    "fmt"
    emailverifier "github.com/AfterShip/email-verifier"
)

func main() {
    verifier := emailverifier.
        NewVerifier().
        EnableDomainSuggest()

    ret, _ := verifier.Verify("test@gmai.com")
    fmt.Println("Suggestion 1: ", ret.Suggestion)

    suggestion := verifier.SuggestDomain(ret.Syntax.Domain)
    fmt.Println("Suggestion 2: ", suggestion)
}

Real result

Suggestion 1: 
Suggestion 2:  gmail.com

Expected result:

Suggestion 1:  gmail.com
Suggestion 2:  gmail.com

These two examples should have the same results however the Verify function results an empty suggestion while SuggestDomain function works as expected.

However testing the same code with this example test@gma.com has the same result with both cases:

Suggestion 1:  gmal.com
Suggestion 2:  gmal.com

Tested with Go version 1.21