Skip to main content

Email validation

EmailValidationAsync() checks whether an email address can receive mail before you store it. It also flags disposable, free, role and catch-all addresses.

Email.cscsharp
using IdealPostcodes;

using var client = new IdealPostcodesClient("ak_test");

var result = (await client.EmailValidationAsync(new EmailValidationParams("support@ideal-postcodes.co.uk"))).Result;

if (result is Email email)
{
Console.WriteLine($"{email.Result} deliverable={email.Deliverable}");
}
else
{
Console.WriteLine($"Could not check: {string.Join(", ", result.Suggestions)}");
}

The address is the one required parameter, so it is the EmailValidationParams constructor argument. Your key needs email validation enabled.

Result​

Result is one of three values:

ResultMeaningClass
deliverableThe mailbox accepts mailEmail, with Deliverable true
not_deliverableMail will bounce, or the domain cannot receive mailEmail, with Deliverable false
unknownThe API could not check the addressUnknownEmail, with every flag null

An Email carries four more bool flags:

  • Disposable: a throwaway domain, such as temp-mail.org
  • Free: a free provider, such as gmail.com or outlook.com
  • Role: a role mailbox, such as admin@ or support@
  • Catchall: the domain accepts mail for any mailbox, so a deliverable result proves less

Result and Suggestions are on IEmailResponseResult, so they read without a type check.

Corrections​

When the domain does not resolve or publishes no MX records, Suggestions can hold corrected email addresses. The API does not validate them, so check a suggestion before you use it. Every other result returns an empty list.

Cost​

One lookup for a checked address. An unknown result costs nothing, and neither does a domain that does not resolve or has no MX records. The API rejects an address over 320 characters with an ApiException.

See EmailValidationAsync() for the parameters and the email validation guide for how the checks work.