.Net

You can find the ZeroBounce .NET API Wrapper on our GitHub - .NET API repository.

You can also easily consume and keep it updated within your Visual Studio Project with Nuget Package Manager: https://www.nuget.org/packages/ZeroBounceAPIWrapper/

This wrapper class takes all the work out of coding against the API and allows you to easily set properties and get results instantly.

The .NET API Wrapper takes these input parameters.

.NET API input parameters

  • Property
    Possible Values
  • apiKey
    The api key located in your account dashboard.
  • emailToValidate
    The email address your validating.
  • ipAddress
    [optional] - The IP Address the email address was captured from
  • requestTimeOut
    Timeout settings in milliseconds, setting this enables you to control how long you are willing to wait for to send the request to the API. When the timeout occurs an "Unknown" result is returned.
  • readTimeOut
    The timeout settings in milliseconds, setting this enables you to control how long you are willing to wait for the API to respond to your request. When the timeout occurs an "Unknown" result is returned.

The ValidateEmail and GetCredit methods return objects from which you can easily retrieve properties the properties below.

Properties and possible values returned by the methods:

ValidateEmail method

  • Property
    Values
  • address
    The email address you are validating.
  • status
    Valid
    Invalid
    Catch-All
    Unknown
    Spamtrap
    Abuse
    DoNotMail
  • subStatus
    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
  • account
    The portion of the email address before the "@" symbol.
  • domain
    The portion of the email address after the "@" symbol.
  • disposable
    [true/false] If the email domain is disposable, which are usually temporary email addresses.
  • toxic
    [true/false] These email addresses are known to be abuse, spam, or bot created.
  • firstname
    The first name of the owner of the email when available or [null].
  • lastname
    The last name of the owner of the email when available or [null].
  • gender
    The gender of the owner of the email when available or [null].
  • creationDate
    The creation date or [null].
  • location
    The location of the owner of the email when available or [null].
  • processedAt
    The UTC time the email was validated.

These additional properties are available when you set the ipAddress property.

  • Property
    Possible Values
  • country
    The country the IP address is from
  • region
    The state/region the IP address is from
  • city
    The city the IP address is from
  • zipcode
    The Zip Code the IP address is from

GetCredit method

  • Property
    Possible Values
  • credits
    The number of credits left in account for email validation.

Visual Basic

      
  Dim zeroBounceAPI = New ZeroBounce.ZeroBounceAPI

  'set input parameters
  zeroBounceAPI.apiKey = "Your API Key" 'Required 
  zeroBounceAPI.emailToValidate = "Email address your validating" 'Required
  zeroBounceAPI.ipAddress = "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
      

c#


  var zeroBounceAPI = new ZeroBounce.ZeroBounceAPI();

  //set input parameters
  zeroBounceAPI.apiKey = "Your API Key"; //Required
  zeroBounceAPI.emailToValidate = "Email address your validating"; //Required
  zeroBounceAPI.ipAddress = "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; //Optional - Any integer value in milliseconds
  zeroBounceAPI.requestTimeOut = 150000; //Optional -Any integer value in milliseconds
  
  //validate email and assign results to an object
  var apiProperties = zeroBounceAPI.ValidateEmail();
  
  //check credits and assign results to an object
  var apiCredits= zeroBounceAPI.GetCredits();
  
  //use the properties to make decisions on
  switch (apiProperties.status)
    {
        case "Invalid":
            Console.WriteLine("Invalid");
            break;
        case "Valid":
            Console.WriteLine("Valid");
            break;
        default:
            Console.WriteLine(apiProperties.status);
            break;
    }