Go SDK · Feature

Email Validation & Verification in Go

Check whether an email address is real, deliverable, and safe to accept — before it ever enters your database. The SDK exposes three levels: a fast syntax/MX/disposable check, full SMTP verification, and a batch endpoint for cleaning whole lists.

Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
What it does

Three levels of email checking

Not every check needs an SMTP probe. EmailInfo validates syntax and MX and flags disposable providers fast enough to run inline on a sign-up form. ValidateEmail goes further, connecting to the mail server to confirm the mailbox is deliverable and adding role-account, free-provider, and catch-all signals. ValidateEmailBatch applies that advanced check across an entire list in one request.

Prerequisites

1

Fast check with EmailInfo

A lightweight check (no SMTP probe): validates syntax, confirms the domain has MX records, and flags disposable/throwaway providers. Use it inline on sign-up forms.

client := ipapi.NewClient(ipapi.WithAPIKey(os.Getenv("IP_API_IO_KEY")))
ctx := context.Background()

info, err := client.EmailInfo(ctx, "user@example.com")
if err != nil {
	log.Fatal(err)
}

fmt.Println(info.Syntax.IsValid) // true
fmt.Println(info.IsDisposable)   // false
fmt.Println(info.HasMXRecords)   // true
if len(info.MXRecords) > 0 {
	fmt.Println(info.MXRecords[0].Hostname)
}
2

Full SMTP verification with ValidateEmail

Advanced verification that connects to the mail server to confirm the mailbox is deliverable, and adds role-account, free-provider, catch-all and Gravatar signals.

result, _ := client.ValidateEmail(ctx, "user@example.com")

fmt.Println(result.Reachable) // "yes" | "no" | "unknown"
if result.SMTP != nil {
	fmt.Println(result.SMTP.Deliverable, result.SMTP.CatchAll)
}
fmt.Println(result.Disposable)  // false
fmt.Println(result.RoleAccount) // false  (e.g. info@, support@)
fmt.Println(result.Free)        // false  (e.g. gmail.com)
fmt.Println(result.Suggestion)  // typo fix, e.g. "user@gmail.com"
3

Clean a list with ValidateEmailBatch

Advanced-validate up to 100 addresses in one request — the building block for email list cleaning. Returns an error if the slice is empty or longer than 100.

batch, _ := client.ValidateEmailBatch(ctx, []string{
	"user@example.com",
	"fake@mailinator.com",
})

fmt.Println(batch.TotalProcessed)        // 2
fmt.Println(batch.SuccessfulValidations) // 2

for email, result := range batch.Results {
	fmt.Println(email, result.Reachable, result.Disposable)
}
Reference

Response reference

AdvancedEmailValidation (from ValidateEmail)

FieldTypeDescription
EmailstringThe address checked
Reachablestring"yes", "no" or "unknown"
SMTP*AdvancedSMTPHostExists, Deliverable, FullInbox, CatchAll, Disabled
Gravatar*AdvancedGravatarHasGravatar, GravatarURL
SuggestionstringSuggested correction for a likely typo
DisposableboolThrowaway provider
RoleAccountboolRole address (info@, sales@, …)
FreeboolFree webmail provider
HasMXRecordsboolDomain can receive mail
FAQ

Frequently asked questions

How do I validate an email address in Go?

For a fast check, call client.EmailInfo(ctx, email) — it validates syntax, confirms the domain has MX records, and flags disposable providers without an SMTP probe. For full deliverability, use client.ValidateEmail(ctx, email), which connects to the mail server.

What's the difference between EmailInfo and ValidateEmail?

EmailInfo is a lightweight syntax/MX/disposable check, ideal inline on sign-up forms. ValidateEmail performs advanced SMTP verification and adds role-account, free-provider, catch-all and Gravatar signals — use it before sending important mail or accepting a paying customer.

How do I clean a whole list of emails?

Use client.ValidateEmailBatch(ctx, emails) with up to 100 addresses per request — the building block for email list cleaning. It returns a Results map of email to result and an error if the slice is empty or longer than 100.

Can it detect disposable / throwaway emails?

Yes. Both EmailInfo and ValidateEmail return a disposable flag (IsDisposable / Disposable) for throwaway providers like mailinator.com, so you can reject or down-rank them at sign-up.

Start building with the ip-api.io Go SDK

Run go get github.com/ip-api-io/ipapi-go, drop in your free API key, and ship in minutes — one typed, context-aware client for geolocation, fraud detection, and email validation.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Found a bug in the SDK?

The ipapi-go module is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub