alt text

Email Verification API Client

email-hippo-public MyGet Build Status

About

This is a .NET package built for easy integration with Email Hippo RESTful API services. For further information on the RESTful server side implementation, please see the Docs.

How to get the package

From Nuget.

install-package EmailHippo.EmailVerify.Api.Client

Who is the package for?

What this package can do

If you're working in the .NET environment, this package can save you hours of work writing your own JSON parsers, message pumping logic, threading and logging code.

Prerequisites

Features

How to use the package

Please note that full example code for all of the snippets below are available in the "EmailHippo.EmailVerify.Api.Client.Tests" project which can be found in the GitHub repository for this project.

Step 1 - license and initialize

This software must be initialized before use. Initializaton is only needed once per app domain. The best palce to do this in in the hosting process bootstrap code. For example, a web app use global.asax, a console app use Main() method.

Supply license configuration to the software by either:

XML configuration In app.config or web.config

<appSettings>
    <add key="Hippo.EmailVerifyApiKey" value="{your license key}"/>
</appSettings>

and then call

ApiClientFactoryV2.Initialize();

or:

in code as part of initialization

Invoke static method ApiClientFactoryV2.Initialize(string licenseKey = null)... as follows if supplying the license in code:

/*Visit https://www.emailhippo.com to get a license key*/
ApiClientFactoryV2.Initialize("{your license key}");

Step 2 - create

The main client object is created using a static factory as follows:

Example 2 - creating the client

var myService = ApiClientFactoryV2.Create();

Step 3 - use

Once you have a reference to the client object, go ahead and use it.

Example 3 - checking one or more email address synchronously

var responses = myService.Process(new VerificationRequest{Emails = new List<string>{"me@here.com"});

/*Process responses*/
/*..responses*/

Example 4 - checking more than one email address asynchronously

var responses = myService.ProcessAsync(new VerificationRequest{Emails = new List<string>{"me@here.com","me2@here.com"}, CancellationToken.None).Result;

/*Process responses*/
/*..responses*/

Example 5 - progress reporting

Progress can be captured using the built in event delegate "ProgressChanged" as follows

myService.ProgressChanged += (o, args) => Console.WriteLine(JsonConvert.SerializeObject(args));

Example 6 - logging

High performance, Azure compatible exception and application logging is provided using SLAB.

Enable logging using standard SLAB listeners.

var ObservableEventListener listener1;
var ObservableEventListener listener2;

listener1 = new ObservableEventListener();
listener1.EnableEvents(ExceptionLoggingEventSource.Log, EventLevel.Error);

listener1.LogToConsole();

listener2 = new ObservableEventListener();
listener2.EnableEvents(ActivityLoggingEventSource.Log, EventLevel.Error, Keywords.All);

listener2.LogToConsole();

For full details of logging options see the "EmailHippo.EmailVerify.Api.Client.Diagnostics" namespace in the source code.