Prerequisites
- A stable Rust toolchain with
ip-api-ioadded - A free ip-api.io API key
Fast check with email_info
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 = Client::new(std::env::var("IP_API_IO_KEY")?);
let info = client.email_info("user@example.com").await?;
println!("{}", info.syntax.is_valid); // true
println!("{}", info.is_disposable); // false
println!("{}", info.has_mx_records); // true
if let Some(record) = info.mx_records.first() {
println!("{}", record.hostname);
} Full SMTP verification with validate_email
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 = client.validate_email("user@example.com").await?;
println!("{}", result.reachable); // "yes" | "no" | "unknown"
if let Some(smtp) = &result.smtp {
println!("{} {}", smtp.deliverable, smtp.catch_all);
}
println!("{}", result.disposable); // false
println!("{}", result.role_account); // false (e.g. info@, support@)
println!("{}", result.free); // false (e.g. gmail.com)
if let Some(suggestion) = &result.suggestion {
println!("{suggestion}"); // typo fix, e.g. "user@gmail.com"
} Clean a list with validate_email_batch
Advanced-validate up to 100 addresses in one request — the building block for email list cleaning. Errors if the slice is empty or longer than 100.
let batch = client
.validate_email_batch(&["user@example.com", "fake@mailinator.com"])
.await?;
println!("{}", batch.total_processed); // 2
println!("{}", batch.successful_validations); // 2
for (email, result) in &batch.results {
println!("{email} {} {}", result.reachable, result.disposable);
}