TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
Library to suggest a correct domain when your users misspell it in an email address. Objective-C port of https://github.com/Kicksend/mailcheck
Copy mailcheck.h and mailcheck.m from the Mailcheck folder to your project.
#import "Mailcheck.h"
NSDictionary *result = [Mailcheck suggest:@"[email protected]"]
Result will contain nil if the domain appears to be valid. Otherwise the suggestion will be a dictionary like this:
{@"address": @"test",
@"domain": @"hotmail.com",
@"full": @"[email protected]"}
Now includes a check if the email is valid thanks to https://github.com/NZN/NSString-Email
#import "Mailcheck.h"
NSDictionary *result = [Mailcheck check:@"[email protected]"]
Result will contain keys for "valid" and "suggestion"
{@"valid": @(YES),
@"suggestion": {@"address": @"test",
@"domain": @"hotmail.com",
@"full": @"[email protected]"}}
Supply your own domain lists:
NSDictionary *result = [Mailcheck check:@"[email protected]" domains:@[@"mydomain.co"] topLevelDomains:@[@"co"]];
Or add to the default list:
NSDictionary *result = [Mailcheck check:@"[email protected]" extraDomains:@[@"mydomain.co"] extraTopLevelDomains:@[@"co"]];
Check the MailcheckDemo or the GHUnit tests in TestMailcheck.m for more usage examples. You can run the tests by loading the demo project and selecting the Tests scheme.