Syntax Email Validation API
Client-side regex catches obvious mistakes. Server-side RFC 5322 validation catches the edge cases — and can't be bypassed.
What Mailbeam checks
Every verification runs 7 checks in parallel and returns a structured result in under 100ms.
RFC 5322 compliant parsing
Mailbeam validates email syntax against the RFC 5322 standard. This includes quoted local parts, internationalized characters, and uncommon but valid formats that most regex implementations reject incorrectly.
Email normalization
The response includes a `normalized_email` field: lowercase domain, trimmed whitespace, and consistent formatting. Store the normalized version to prevent duplicate accounts from the same address.
Typo suggestion
Common domain misspellings (gmal.com, hotmal.com, outlok.com) are detected and a corrected suggestion is returned. Surface the suggestion in your UI before the user submits.
Syntax_check boolean
The `syntax_check` boolean in the response isolates the syntax result from the full `valid` composite. Use it to distinguish a syntax failure from an MX or SMTP failure in your error handling.
Immediate failure for invalid syntax
When syntax validation fails, Mailbeam returns immediately — no DNS or SMTP calls are made. This makes syntax failure the fastest possible response, under 5ms.
Server-side enforcement that can't be bypassed
Client-side validation can be disabled by turning off JavaScript or using developer tools. Server-side syntax validation via API ensures every address stored in your database is RFC-compliant.
How it works
Email string parsed
The email is split into local part (before @) and domain (after @). Each part is validated independently against RFC 5322 rules.
Typo detection runs
The domain is compared against a dictionary of common legitimate email domains. If a high-probability correction exists (edit distance ≤ 2), a suggestion is generated.
Normalization applied
Domain is lowercased, whitespace trimmed, and the normalized email string is returned in the response. Plus-addressing tags are preserved (not stripped) in the normalization.
Early return or full pipeline
If syntax fails, Mailbeam returns immediately with `syntax_check: false`. If syntax passes, the remaining checks (MX, SMTP, disposable, etc.) proceed in parallel.
Integrate in minutes
import java.net.http.*;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@Service
public class EmailValidationService {
private final HttpClient http = HttpClient.newHttpClient();
private final ObjectMapper mapper = new ObjectMapper();
private final String apiKey = System.getenv("MAILBEAM_KEY");
public ValidationResult validate(String email) throws Exception {
String body = mapper.writeValueAsString(Map.of("email", email));
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.mailbeam.dev/v1/verify"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> resp = http.send(req, HttpResponse.BodyHandlers.ofString());
JsonNode result = mapper.readTree(resp.body());
if (!result.get("syntax_check").asBoolean()) {
String suggestion = result.has("suggestion") && !result.get("suggestion").isNull()
? result.get("suggestion").asText() : null;
throw new InvalidEmailException("Invalid email format.", suggestion);
}
return new ValidationResult(
result.get("valid").asBoolean(),
result.get("score").asInt(),
result.get("normalized_email").asText()
);
}
}When to use it
Server-side API input validation
In microservice architectures, validate email fields at every API boundary. A syntax check at the API gateway prevents malformed data from propagating through your system.
Database import sanitization
When importing email data from external sources (CSVs, legacy systems, third-party tools), a syntax check identifies malformed entries before they enter your database.
Registration form enforcement
Combine lightweight client-side UX validation with authoritative server-side enforcement. The server check catches what the client misses and can't be bypassed.
Data quality audits
For existing databases with historical email data, run a batch syntax check to identify and flag records that don't meet RFC 5322 standards — typically a prerequisite for GDPR data quality compliance.
Frequently asked questions
Ready to integrate?
Free tier includes 1,000 verifications/month. No credit card required.