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.
From Nuget.
install-package EmailHippo.EmailVerify.Api.Client
- .NET developers and system integrators needing a fast start to using Email Hippo technology.
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.
- Visual Studio 2012 or later
- .NET 4.5 or later
- API license key from Email Hippo
- Built for high performance throughput. Will scale for concurrency and performance based on your hardware configuration (i.e. more CPU cores = more throughput).
- Sync and async methods.
- Parallel batch processing available.
- Progress reporting via event callbacks built in.
- Extensive Logging built in using async SLAB.
Fast throughput can be achieved by sending lists (IList) of emails for processing. Speed of overall processing depends on your hardware configuration (i.e. number of effective CPU cores and available RAM).
Processing for lists of email is executed in parallel using multiple threads.
- CPU : Intel 2700k (4 core + HT = 8 effective cores)
- RAM : 32GB
- Network (WAN) : Fibre (40Mb/sec)
notes on tests :
- tests run on sequence of randomized @gmail email addresses
- caching not a test factor (as using random email addresses)
# Emails | Run Time to Completion (ms) | Processing Rate (emails /sec) |
---|---|---|
20 | 7,803 | 2.56 |
50 | 14,755 | 3.38 |
100 | 27,128 | 3.69 |
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.
This software must be initialized before use. Initializaton is only needed once per app domain. The best place 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}");
The main client object is created using a static factory as follows:
Example 2 - creating the client
var myService = ApiClientFactoryV2.Create();
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.