• Category Category: Coding
  • Comment Comments: 1
  • View View: 5841
  • View Word Count: 432

What are disposable email addresses?

Users may not trust a website with their email address because they may fear that will get spammed or that their email information will be leaked to third parties. So they use a disposable email to sign up on a website and use its features without providing the website with their email address.

 

Mailinator Disposable Email Service

A popular disposable email provider (Mailinator).

 

The Problem

However, an issue arises. What if the website needs to contact a user? What if the user is missing out on important information and news about the things they signed up for in the first place. Hence, the need to disallow users from registering with disposable emails on these websites becomes crucial.

 

The Solution

Below is some PHP code that will allow you to block disposable email addresses. Not that implementation of this code will require that you have some knowledge of PHP.

 

The function – Store this in a file called disposablecheck.php or something similar and upload it to some directory on your website.

What this function does is split apart an email address that is provided and compare its domain to an array of well known disposable email providers. It will be necessary to update this blacklist to keep out most of the well known disposable email providers. The function will return a 1 if a disposable email is detected and a if it one is not.

 

To update the array list, simply add a website domain without the @ sign at the end of the list (before the ); ) with double quotes surrounding it. Then add a comma to the end of this line. For example, if I wanted to add example.com, I would add:

So that the end of the list would look like:

 

The Check – Add this to your registration script or page. In the following code, $email is the variable that contains the email a user has indicated they want to sign up with. It runs the email through the function disposablecheck and then allows you to manipulate the result.

Typically you would provide an error or redirect the user  in scenario where no disposable email is detected and just let the script continue if no disposable email was detected. The following code is one way in which you can do this for a wordpress website.

 

The End Result

Before implementing this on one of my websites, I would get at least 15 low quality registrations a day. After this implementation that has decreased to zero! Low quality users often give up after trying a few disposable emails and move on to the next website. However, make sure you update the array blacklist as necessary.

Good luck!

   

About the Author Gold Star Staff Member

Mohammad Permalink: http://www.articlevoid.com/?action=permalink&article=50839
Author:
Website: http://www.mohammadg.com
About me: The webmaster of ArticleVoid. I own many other websites and I am fluent in X(HTML), PHP, Javascript, Java and C++. I spend a lot of my time online and currently own many websites. I love writing and created this website so users can share their knowledge in order to make the world just a little bit smarter!

  • authorBy:
  • writerPosted On:
  • live Published articles: 43

Comment (1)

  • Itz
    Itz (January 10, 2013 at 12:56 am)

    Hi Mohammad,

    one hard point is to keep the list of disposable domains up to date. Have you heared of http://www.block-disposable-email.com before? It could also be a good solution for your needs.

    Free for up to 200 queries a month.

Post Comment

Most Recent Articles from Coding Category: