|
|
|
|
Like this code?
Show the author your appreciation.
|
|
| |
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 | |
|
|