Skip to main content

Email validation

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

email.rbruby
require "ideal_postcodes"

client = IdealPostcodes::Client.new(api_key: "ak_test")
email = client.email_validation(query: "support@ideal-postcodes.co.uk").result

if email.is_a?(IdealPostcodes::Types::Email)
puts "#{email.result} deliverable=#{email.deliverable}"
else
puts "Could not check: #{email.suggestions.join(', ')}"
end

Your key needs email validation enabled.

Results​

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 nil

An Email carries four more flags, each true or false:

  • 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

Suggested corrections​

Sometimes. 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 array.

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 ApiError.

See validate for the keywords and the email validation guide for how the checks work.