Prerequisites
- A .NET 6+ project with
IpApiIoadded - A free ip-api.io API key
Fast check with EmailInfoAsync
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.
var client = new IpApiClient(Environment.GetEnvironmentVariable("IP_API_IO_KEY")!);
var info = await client.EmailInfoAsync("user@example.com");
Console.WriteLine(info.Syntax.IsValid); // True
Console.WriteLine(info.IsDisposable); // False
Console.WriteLine(info.HasMxRecords); // True
if (info.MxRecords.FirstOrDefault() is { } record)
Console.WriteLine(record.Hostname); Full SMTP verification with ValidateEmailAsync
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.
var result = await client.ValidateEmailAsync("user@example.com");
Console.WriteLine(result.Reachable); // "yes" | "no" | "unknown"
if (result.Smtp is { } smtp)
Console.WriteLine($"{smtp.Deliverable} {smtp.CatchAll}");
Console.WriteLine(result.Disposable); // False
Console.WriteLine(result.RoleAccount); // False (e.g. info@, support@)
Console.WriteLine(result.Free); // False (e.g. gmail.com)
if (result.Suggestion is { } suggestion)
Console.WriteLine(suggestion); // typo fix, e.g. "user@gmail.com" Clean a list with ValidateEmailBatchAsync
Advanced-validate up to 100 addresses in one request — the building block for email list cleaning. Throws if the list is empty or longer than 100.
var batch = await client.ValidateEmailBatchAsync(
new[] { "user@example.com", "fake@mailinator.com" });
Console.WriteLine(batch.TotalProcessed); // 2
Console.WriteLine(batch.SuccessfulValidations); // 2
foreach (var (email, result) in batch.Results)
Console.WriteLine($"{email} {result.Reachable} {result.Disposable}");