In some projects, we need to block user to enter email Ids from public email domain like,, etc. One of the way to do this is as shown below, using PHP.

A simple PHP script will be used to do this. We will take all the domains which we want to block in an array, and then we will check all the emails passed from HTML form at php end by comparing it with the blocked array.




Email Password Confirm Password SignUp

PHP Code:

See Live Demo:
Live Demo

Download Code:
Download Code

Download List of Free email Service Providers, which you might want to block, put these in array above:

Email Domain List