Java

You can find the ZeroBounce Java API v2 on our GitHub - Java API v2.

This is a java wrapper class example for the ZeroBounce API v2.

The project has 2 dependencies:

  • Apache HttpClient
  • JSON (org.json)

Either download the dependencies separately and add them to the relevant path or add the following dependencies to your pom.xml file if you're building via Maven (already added if you're cloning this repo):

Validate(email) method:

  • Properties
    Possible Values
  • getEmailAddress()
    The email address you are validating.
  • getStatus()
    Valid
    Invalid
    Catch-All
    Unknown
    Spamtrap
    Abuse
    DoNotMail
  • getSubStatus()
    antispam_system
    greylisted
    mail_server_temporary_error
    forcible_disconnect
    mail_server_did_not_respond
    timeout_exceeded
    failed_smtp_connection
    mailbox_quota_exceeded
    exception_occurred
    possible_traps
    role_based
    global_suppression
    mailbox_not_found
    no_dns_entries
    failed_syntax_check
    possible_typo
    unroutable_ip_address
    leading_period_removed
    does_not_accept_mail
    alias_address
    role_based_catch_all
  • getAccount()
    The portion of the email address before the "@" symbol.
  • getDomain()
    The portion of the email address after the "@" symbol.
  • getDidYouMean()
    Suggestive Fix for an email typo or [null]
  • getDomainAgeDays()
    Age of the email domain in days or [null].
  • isFreeEmail()
    [true/false] If the email comes from a free provider.
  • isMXFound()
    [true/false] Does the domain have an MX record.
  • getMXRecord()
    The preferred MX record of the domain or [null].
  • getSMTPProvider()
    The SMTP Provider of the email or [null] (BETA).
  • getFirstName()
    The first name of the owner of the email when available or [null].
  • getLastName()
    The last name of the owner of the email when available or [null].
  • getGender()
    The gender of the owner of the email when available or [null].
  • getCountry()
    The country the IP address is from.
  • getCity()
    The city the IP address is from.
  • getZipcode()
    The zip code the IP address is from.
  • getRegion()
    The region/state the IP address is from.
  • getProcessedAt()
    The UTC time the email was validated.

getCredit() method

  • Properties
    Possible Values
  • getCredits()
    The number of credits left in account for email validation
      
      Dim zeroBounceAPI = New ZeroBounce.ZeroBounceAPI

      'set input parameters
      zeroBounceAPI.api_key = "Your API Key" 'Required 
      zeroBounceAPI.emailToValidate = "Email address you are validating" 'Required
      zeroBounceAPI.ip_address = "IP address the email signed up with" 'Optional
      
      'Depending on how you use the API, you might want it to time out faster, for example on a registration screen. 
      'Normally the API will return results very fast, but a small percentage of mail servers 
      'take upwards of 20+ seconds to respond. 
      'If the API times out, it will return a status of "Unknown" and a sub_status of "timeout_exceeded"  
      
      zeroBounceAPI.readTimeOut = 200000 'Any integer value in milliseconds
      zeroBounceAPI.requestTimeOut = 150000 'Any integer value in milliseconds 
      
      
      Dim apiProperties = zeroBounceAPI.ValidateEmail
      Dim apiCredits = zeroBounceAPI.GetCredits
      
      'use the properties to make decisions on
      Select Case (apiProperties.status)
          Case "Invalid"
              Console.WriteLine("Invalid")
          Case "Valid"
              Console.WriteLine("Valid")
          Case Else
              Console.WriteLine(apiProperties.status)
      End Select