Giter VIP home page Giter VIP logo

bzgmailgunemailvalidation's Introduction

BZGMailgunEmailValidation

A simple objective-C wrapper for the Mailgun email validation API.

BZGMailgunEmailValidator *validator = 
    [BZGMailgunEmailValidator validatorWithPublicKey:YOUR_PUBLIC_KEY];

[validator validateEmailAddress:self.emailFieldCell.textField.text
                        success:^(BOOL isValid, NSString *didYouMean) {
                        // Validation succeeded
                      } failure:^(NSError *error) {
                        // Validation failed
                      }];

Notes

  • By default, a BZGMailgunEmailValidator instance performs fallback regex-based validation if Mailgun validation fails. Set performsFallbackValidation to NO if you'd prefer to handle this case yourself.
  • Caveat implementor: success and failure blocks are executed on the main queue.

Installation

If you're using Cocoapods, simply add pod 'BZGMailgunEmailValidation' to your Podfile.

Otherwise, add BZGMailgunEmailValidator.h and BZGMailgunEmailValidator.m to your project.

References

http://blog.mailgun.com/post/free-email-validation-api-for-web-forms/

http://documentation.mailgun.com/api-email-validation.html

Roadmap

bzgmailgunemailvalidation's People

Contributors

vprtwn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bzgmailgunemailvalidation's Issues

Move from main queue

How to move the success and failure blocks from the main queue. Can you give please give a solution

Add request timeout property

Hi! In your code I saw that you are using a fixed timeout of 3 seconds for connecting MailGun. In practice, I can say that when my cellular connection was just a bit not ideal, though quite stable, the validator frequently failed. It seems, 3 seconds are often not enough. Though making it much longer would disturb the user, of course... So, maybe you could add timeout as another validator property?
Thank you for a great API though!

Doesn't actually return failure

Cool class that I appreciated, but it passed success every time as there is not an if statement to display the failure if the is_valid key is 0.

I just added this that might help you finish this out.

 if(isValid == YES) {
                                           dispatch_async(dispatch_get_main_queue(), ^{
                                               success(isValid, didYouMean);
                                           });
                                       } else {
                                           NSError *errorVal = nil;
                                           dispatch_async(dispatch_get_main_queue(), ^{
                                               failure(errorVal);
                                           });
                                       }

Uneven response when typed fast.

Scenerio : When typing is fast then the response which comes is uneven

i.e shrawan.com response is is_valid = false and did_you_mean is "shrawan.com"

and the response of shrawan.co is is_valid = true and did_you_mean is nil

Type : shrawan.com fast in app and call email Validation API

Log Trace

2017-03-08 11:42:13.254392 TextValidation[2261:547905] **didYouMean== [email protected] --- && isValid 0 **
2017-03-08 11:42:13.536171 TextValidation[2261:547905] **didYouMean== (null) --- && isValid 1 **
2017-03-08 11:42:14.446487 TextValidation[2261:547905] **didYouMean== [email protected] --- && isValid 0

So last log is isValid is 0 . Which is wrong and must be isValid is true

Demo app
Generate above scenerio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.