Prerequisites
- A Java 17+ project with
io.ip-api:ipapiadded - A free ip-api.io API key
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.
IpApiClient client = IpApiClient.builder()
.apiKey(System.getenv("IP_API_IO_KEY"))
.build();
var info = client.emailInfo("user@example.com");
System.out.println(info.syntax().isValid()); // true
System.out.println(info.isDisposable()); // false
System.out.println(info.hasMxRecords()); // true
if (!info.mxRecords().isEmpty()) {
System.out.println(info.mxRecords().get(0).hostname());
} 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.
var result = client.validateEmail("user@example.com");
System.out.println(result.reachable()); // "yes" | "no" | "unknown"
if (result.smtp() != null) {
System.out.println(result.smtp().deliverable() + " " + result.smtp().catchAll());
}
System.out.println(result.disposable()); // false
System.out.println(result.roleAccount()); // false (e.g. info@, support@)
System.out.println(result.free()); // false (e.g. gmail.com)
if (result.suggestion() != null) {
System.out.println(result.suggestion()); // typo fix, e.g. "user@gmail.com"
} Clean a list with validateEmailBatch
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 = client.validateEmailBatch(
List.of("user@example.com", "fake@mailinator.com"));
System.out.println(batch.totalProcessed()); // 2
System.out.println(batch.successfulValidations()); // 2
batch.results().forEach((email, result) ->
System.out.println(email + " " + result.reachable() + " " + result.disposable()));