Actually Validate Email Address Using Web API and Mashape

In building forms, newsletters, etc it is very common to verify that an email that was entered by user is formatted properly. There are many ways to do this. You can use javascript, jquery, server side, etc.. You can use regex or some other tool but in the end someone could enter something like 12345@IAmAHack.com and it will validate every time. What if there was a way for you to take it one step further and actually verify the email is a valid email and not just a valid “formatted” email.

I came across one such api on mashape.com. This site is dedicated to providing a way to consume API’s. If you have never tried it, I would encourage you to go over there and check this one out. There are really no limitations and it is another way to actually verify that an email address is valid.

figure1
You have to Get an API Key (really not painful at all) and add this to your code. Here is a sample of code in vb.net that will actually return a real result. (True the email is valid, False if it is not)

You can see that I am returning the result into an object.

If you don’t know what unirest_net.dll is or you want to set up a blank project use mashape API then check out my last article.

Note: Take notice of where to enter your APIKey


Imports unirest_net.http
Public Class WebForm1
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'https://www.mashape.com/pozzad/email-validator-1#!documentation
        Dim jsonresponse As HttpResponse(Of myEmailtest) = Unirest.[get]("https://pozzad-email-validator.p.mashape.com/emailvalidator/validateEmail/david@arvixe.com") _
                                                      .header("X-Mashape-Authorization", "EnterYourAPIKeyHere") _
                                                      .asJson(Of myEmailtest)()
        Response.Write(jsonresponse.Body.isValid)
    End Sub
End Class
Public Class myEmailtest
    Public Property isValid As String
End Class

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , | Posted under Programming/Coding | RSS 2.0

Author Spotlight

David Bauernschmidt

David Bauernschmidt

I live in the historical triangle of Virginia where I am married with two daughters. I have spent over 13 years working for a Fortune 500 company in the computer area. I started in VB 6.0 and by the time I ended my employment I was supervising a development team where we built many web applications. When my first daughter was born I wanted to spend more time with her so I left and became a programmer analyst for local government as well as launch my own company. Since then I have grown James River Webs into a profitable web design and application company helping small businesses create a big presence on the internet. As an employee I have created web application used by citizens and other companies. I enjoy fly fishing, and spending time with my family. I also enjoy learning new approaches and development tools when it comes to developing applications.

Leave a Reply

Your email address will not be published. Required fields are marked *


× 4 = 32

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>