Programming language: Go
License: MIT License
Tags: Email    

go-email-validator alternatives and similar packages

Based on the "Email" category.
Alternatively, view go-email-validator alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of go-email-validator or a related project?

Add another 'Email' Package


Go Reference codecov Go Report

Library under development (Interfaces may be changed slightly)

Demo on rapidapi.com


go get -u github.com/go-email-validator/go-email-validator

Available validators

[email protected]

  • [syntaxValidator](pkg/ev/validator_syntax.go)
    1. NewSyntaxValidator() - mail.ParseAddress from built-in library
    2. NewSyntaxRegexValidator(emailRegex *regexp.Regexp) - validation based on regular expression
  • [disposableValidator](pkg/ev/validator_disposable.go) based on mailchecker by default (set is replaceable)
  • [roleValidator](pkg/ev/validator_role.go) bases on role-based-email-addresses by default (set is replaceable)
  • [mxValidator](pkg/ev/validator_mx.go)
  • [smtpValidator](pkg/ev/validator_smtp.go)

    to use proxy connection, DialFunc need to be changed in [Checker](pkg/ev/evsmtp/smtp.go). There is [evsmtp.H12IODial](pkg/ev/evsmtp/proxy.go), implementing for h12w.

  • [banWordsUsernameValidator](pkg/ev/validator_banwords_username.go) looks for banned words in username

  • [blackListEmailsValidator](pkg/ev/validator_blacklist_email.go) blocked emails from list

  • [blackListValidator](pkg/ev/validator_blacklist_domain.go) blocked emails with domains from black list

  • [whiteListValidator](pkg/ev/validator_whitelist_domain.go) accepts only emails from white list

  • [gravatarValidator](pkg/ev/validator_gravatar.go) check existing of user on gravatar.com


With builder

package main

import (

func main() {
  // create defaults DepValidator with GetDefaultFactories() as list of validators
  builder := ev.NewDepBuilder(nil).Build()
     to set another list of initial validators
     builder := NewDepBuilder(&ValidatorMap{
         ev.ValidatorName: ev.Validator,

  // builder.Set(ev.ValidatorName, NewValidator()) builder
  // builder.Has(names ...ev.ValidatorName) bool
  // builder.Delete(names ...ev.ValidatorName) bool

  validator := builder.Build()

  v := validator.Validate(NewInput(evmail.FromString("[email protected]")))
  if !v.IsValid() {
    panic("email is invalid")


Single validator

package main

import (

func main() {
  var v = ev.NewSyntaxValidator().Validate(NewInput(evmail.FromString("[email protected]"))) // ev.ValidationResult

  if !v.IsValid() {
    panic("email is invalid")


Addition options

To set options for different validators, use NewInput(..., NewKVOption(ValidatorName, Options))

    evmail.FromString("[email protected]"), 
    NewKVOption(SMTPValidatorName, evsmtp.NewOptions(evsmtp.OptionsDTO{
        Port: 465,

Use function New...(...) to create structure instead of public.

How to extend

To add own validator, just implement [ev.Validator](pkg/ev/validator.go) interface. For validator without dependencies, you can use structure ev.AValidatorWithoutDeps


  1. [WarningsDecorator](pkg/ev/decorator_warnings.go) allows moving errors to warnings and change result of IsValid() in [ValidationResult](pkg/ev/validator.go).
  2. Cache based on evcahce.Interface, default realization is done for gocache.
    • [CacheDecorator](pkg/ev/decorator_cache.go) saves result of validator. For caching, you can implement evcache.Interface or use gocache implementation by evcache.NewCache. See [Test_Cache](pkg/ev/decorator_cache_test.go) as example.
    • [checkerCacheRandomRCPT](pkg/ev/evsmtp/smtp.go) for caching of RandomRCPTs request. See Test_checkerCacheRandomRCPT_RandomRCPT_RealCache as example.

Notice, to use msgpack you should have exported fields or implement custom encoding/decoding (doc)


Package use zap.

To use logging see in [log package](pkg/log). Default level is zap.ErrorLevel.


  1. For running workflow locally use act


Most Internet Service Providers block outgoing SMTP request.

The StackOverflow thread could be helpful.

To check smtp in telnet

OPEN gmail-smtp-in.l.google.com 25
EHLO localhost
MAIL FROM: <[email protected]>
rcpt to: <[email protected]>
Some mail providers could put your ip in spam filter.

For example:

  1. hotmail.com


  • Tests
    • Add functional tests
    • Find way to compare functions in tests
  • Add binary release
  • Check in spamhaus
  • Add misspelled email
  • Add DKIM checking
  • Add linter in pre-hook and ci
  • Do full thread safe library
  • Copy features from truemail

Inspired by