项目作者: belidzs

项目描述 :
This asynchronous library written in C# checks email addresses against Mailgun's e-mail validation service
高级语言: C#
项目地址: git://github.com/belidzs/MailgunAddressValidator.git
创建时间: 2018-04-23T08:47:47Z
项目社区:https://github.com/belidzs/MailgunAddressValidator

开源协议:MIT License

下载


MailgunAddressValidator - an e-mail validation library

Important: To use this library or run the included tests you need to sign up at https://www.mailgun.com and get a public API key. The first 100 validation is free each month.

Note: I’m not in any way affiliated or endorsed by Mailgun.

Usage

Add NuGet package to your project, then simply start validating:

  1. using MailgunAddressValidator;
  2. namespace MailgunAddressValidatorExamples
  3. {
  4. public class MailgunAddressValidatorExamples
  5. {
  6. private string apikey = "pubkey-xxxxxxxxxxxxxxxxxxxxxxx";
  7. public void ValidateValidAddress()
  8. {
  9. ValidationResult result = Validator.Validate("sales@mailgun.com", apikey);
  10. MessageBox.Show(String.Format("Validation result: {0}", result.IsValid));
  11. }
  12. public void ValidateAddressWithTypo()
  13. {
  14. ValidationResult result = Validator.Validate("test@gmaill.com", apikey);
  15. MessageBox.Show(String.Format("Validation result: {0}\nDid you mean the following? {1}", result.IsValid, result.DidYouMean);
  16. }
  17. }
  18. }

API documentation

You can find the official API documentation for v3 here: https://documentation.mailgun.com/en/latest/api-email-validation-deprecated.html

Running tests with NUnit

If you want to run NUnit tests, you need to rename app.config.example to app.config and replace PublicApiKey with your own public API key. It should look like this: pubkey-xxxxxxxxxxxxxxxxxxxxxxxx