Swift SDK · Feature

Email Validation & Verification in Swift

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.

let client = IpApiClient(apiKey: ProcessInfo.processInfo.environment["IP_API_IO_KEY"]!)

let info = try await client.emailInfo(email: "user@example.com")

print(info.syntax.isValid) // true
print(info.isDisposable)   // false
print(info.hasMxRecords)   // true
if let record = info.mxRecords.first {
    print(record.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.

let result = try await client.validateEmail(email: "user@example.com")

print(result.reachable) // "yes" | "no" | "unknown"
if let smtp = result.smtp {
    print(smtp.deliverable, smtp.catchAll)
}
print(result.disposable)  // false
print(result.roleAccount) // false  (e.g. info@, support@)
print(result.free)        // false  (e.g. gmail.com)
if let suggestion = result.suggestion {
    print(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. Throws if the array is empty or longer than 100.

let batch = try await client.validateEmailBatch(
    emails: ["user@example.com", "fake@mailinator.com"])

print(batch.totalProcessed)        // 2
print(batch.successfulValidations) // 2

for (email, result) in batch.results {
    print(email, result.reachable, result.disposable)
}
Reference

Response reference

AdvancedEmailValidation (from validateEmail)

FieldTypeDescription
emailStringThe address checked
reachableString"yes", "no" or "unknown"
smtpAdvancedSmtp?hostExists, deliverable, fullInbox, catchAll, disabled
gravatarAdvancedGravatar?hasGravatar, gravatarUrl
suggestionString?Suggested 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 Swift?

For a fast check, call try await client.emailInfo(email: email) — it validates syntax, confirms the domain has MX records, and flags disposable providers without an SMTP probe. For full deliverability, use try await client.validateEmail(email: 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 try await client.validateEmailBatch(emails:) with up to 100 addresses per request — the building block for email list cleaning. It returns a results map of email to result.

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 Swift SDK

Add ipapi-swift via Swift Package Manager, drop in your free API key, and ship in minutes — one async 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-swift package is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub