Golang pkg for email validation and normalization.
- Simple email format check (not a complicated regexp, this is why)
- Resolve the host name
import "github.com/goware/emailx"
func main() {
err := emailx.Validate("[email protected]")
if err != nil {
fmt.Println("Email is not valid.")
if err == emailx.ErrInvalidFormat {
fmt.Println("Wrong format.")
}
if err == emailx.ErrUnresolvableHost {
fmt.Println("Unresolvable host.")
}
}
}
import "github.com/goware/emailx"
func main() {
fmt.Print(emailx.Normalize(" [email protected]. "))
// Prints [email protected]
}
Emailx is licensed under the MIT License.