Email validating form

We suggest using Guardpost as part of your email collection form to reduce typos and false address submission in conjunction with a link emailed to the address to confirm the email is valid (double opt-in).

email validating form-57

For example, it allows us to transform something we intuitively understand, like an address list, into something formal that a computer can parse.

So what would the context free grammar for an address list look like?

This is not intended to be a bulk mailing list cleaning service and we reserve the right to disable your account if we see it being used as such.

To call the Guardpost API, just use the publishable API Key in the My Account tab of your Mailgun account (the one with the "pub-key" prefix).

Here is pseudo-code for the above address list example: def get-address-list(): address_list = [] # get address address = get_address() if address is None: return None address_list.append(addr) while True: # get delimiter delimiter = get_delimiter() if delimiter is None: break # get address address = get_address() if address is None: break address_list.append(address) return address_list Just like that, one by one, we slowly built grammar for every part of an email address.

We spent hours pouring over RFCs, looking at bounces, looking at what mail servers actually accept (which is different sometimes from what RFC says), reading how other people were solving this problem to eventually define our own context free grammar for email addresses: We built our parser around the above grammar for what we think is a realistic email address syntax.

Now, on to to the technical details: Address validation is hard for multiple reasons: Our validator service actually consists of five micro-services: Email address syntax is fairly complex, enough to make a pure regular expression based approach cumbersome and unmaintainable (check out RFC 2822 and RFC 5322 about proper email format then this discussion on Stackoverflow if you need some convincing).

That why we wrote a parser that analyzes addresses, and determines if they are valid or not, based on a formal grammar. Formal grammars (and specifically in our case a context free grammar) are a set of rules that define the structure of a string.

Email validation is a hard problem that every single developer, building anything on the web, has to deal with.

We actually have been working on email validation ourselves for years (more on that below).

We looked at the validation services available and weren't satisfied with any of them, either for performance, accuracy or completeness reasons.

Tags: , ,