WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : EAvalidator - This class can be used to validate an e-mail address by checking its domain.
Categories : PHP, PHP Classes, Email, Regexps
ROBERTO ALEMAN
Date : Dec 07th 2009
Grade : Be the 1st to grade this Code Example
Viewed : 952
File : No file for this code example.
Images : No Images for this code example.
Search : More code by ROBERTO ALEMAN
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

It can check a given e-mail address by verifying if it matches a regular expression with a pattern of valid e-mail addresses.

The class can also check the existence e-mail address domain by opening a connection to a host with the e-mail domain name.

index.php
<?php
/*
EValid, Email Address Validator
Author: Roberto Aleman
General Public License (GPL)

How to Work?   
1.- check length of email address max is 320 characters where:
             64 characters max for the user of email address
              1 character max for the @
            255 characters max for the host name
    2.- apply regular expressions to valid email addres string
    3.- check if exist host to send messages to email address
*/
require_once("eavalidator.php");
if(isset(
$_POST['submit']))
{
$newemail = new email_validator();
$newemail->check_email($_POST[Email]);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form action='index.php' method='post' >
<p>Your Email:<input name='Email' type='text' size='50' id="submit" /></p>
<input name='submit' type='submit' /></form>
</body>
</html>

eavalidator.php
<?php

class email_validator
{
function
check_email($EMAIL)
    {
       
$email = trim(strtolower($EMAIL));
        if (
strlen($email) <= 320 AND strlen($email)>0)
        {
            echo
"valid length entry,  : ".$EMAIL."<br/>";
            echo
"it has ".strlen($email)." characters in length</br>";
                   
$model = '/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])'.'(([a-z0-9-])*([a-z0-9]))+'.'(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i';
                        if (
preg_match ($model, $email) == TRUE)
                            {
                                list(
$user, $domain) = explode("@", $email);
                                   
$id = @fopen("http://".$domain,"r");
                                       if (
$id == true )
                                       {
                                            echo
"Valid Email , Send Message to ".$email;
                                           
//function mail() here
                                           
fclose($id);
                                       }
                                       else
                                       {
                                             echo
"Not valid Host, Not Send Message to ".$email;
                                        }
                            }
                            else
                            {
                                echo
"Not valid, Not Send Message to ".$email." characters not accepted or they are missing characters";
                            }
        }
        else
        {
            if (
strlen($lower) == NULL)
            {
                echo
"no valid entry, because is null: ".$email."<br/>";
                echo
"it has ".strlen($lower)." characters in length</br>";
            }
            else
            {
                echo
"no valid entry, because is too much long: ".$email;
                echo
"it has ".strlen($lower)." characters in length characters</br>";
            }
        }
    }
}
?>



validateEmail 2.0 - upgraded version of the old validateEmail function used to validate email addresses via SMTP and regex.
Categories : Email, Regexps, PHP
FormChecker Package - validate any data via classes and patterns.
Categories : PHP, Form Processing, PHP Classes, Regexps
cPanel Email Accounts Creator
Categories : PHP, PHP Classes, Email, Form Processing, Web Services
making links from text
Categories : PHP, Regexps, Email
Validator - A PHP class that can can be used for validating Email IDs and Dates
Categories : PHP, PHP Classes, Data Validation, Email, Date Time
Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip
Categories : Email, Network, PHP, PHP Classes
POP3 Class
Categories : PHP Classes, PHP, Email
PHP MIME Decoder. This class decodes Mime Encoded email message. Attachments are stored in a director. Works with Multipart/alternative, multipart/mixed etc. see http://p3mail.com for example.
Categories : PHP, PHP Classes, Email
Form is a utility class for generating html forms. It provides form initialization and regex based data validation (both server and client side) with a convenient interface. This version obsoletes version 1.0a
Categories : HTML, PHP, PHP Classes, Regexps
Clever Email Validation Function - E-Mail validation function with an eregi expression and socket connection.
Categories : Email, PHP, Regexps
Parsing Simple Template Files and Data
Categories : PHP, PHP Classes, Templates, Regexps
Banknote Validation - A PHP class that provides several methods to quickly validate banknote serial numbers of the following currencies: AUD, CAD, CHF, CNY, EUR, GBP, JPY, USD.
Categories : PHP, PHP Classes, Data Validation, Regexps
YellowPages Content Grabber (PHP5 +)
Categories : PHP, PHP Classes, Regexps, Databases, MySQL
A class for sending email; it has support for To:, Cc:, Bcc: and Reply-To: headers. It requires that you have sendmail installed.
Categories : Email, PHP Classes, PHP
Class that allows the PHP developer to establish connections with a POP3 mail server amd be able to list, retrieve and delete mail messages from a given mail box.
Categories : Network, Email, PHP, PHP Classes