WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : Clever Email Validation Function - E-Mail validation function with an eregi expression and socket connection.
Categories : Email, PHP, Regexps Update Picture
ifsnow *^^*
Date : Feb 14th 2001
Grade : 4 of 5 (graded 4 times)
Viewed : 17062
File : No file for this code example.
Images : No Images for this code example.
Search : More code by ifsnow *^^*
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
/*
==================================================================
=====

ifsnow's email valid check function SnowCheckMail Ver 0.1

funtion SnowCheckMail ($Email,$Debug=false)

$Email : E-Mail address to check.
$Debug : Variable for debugging.

* Can use everybody if use without changing the name of function.

Reference : O'REILLY - Internet Email Programming

HOMEPAGE : http://www.hellophp.com

ifsnow is korean phper. Is sorry to be unskillful to English. *^^*;;

==================================================================
======= */

function SnowCheckMail($Email,$Debug=false)
{
global $HTTP_HOST;
$Return =array();
// Variable for return.
// $Return[0] : [true|false]
// $Return[1] : Processing result save.

if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $Email))
{
$Return[0]=false;
$Return[1]="${Email} is E-Mail form that is not right.";
if ($Debug) echo "Error : {$Email} is E-Mail form that is not right.<br>";
return $Return;
}
else if ($Debug) echo "Confirmation : {$Email} is E-Mail form that is not right.<br>";

// E-Mail @ by 2 by standard divide. if it is $Email this "lsm@ebeecomm.com"..
// $Username : lsm
// $Domain : ebeecomm.com
// list function reference : http://www.php.net/manual/en/function.list.php
// split function reference : http://www.php.net/manual/en/function.split.php
list ( $Username, $Domain ) = split ("@",$Email);

// That MX(mail exchanger) record exists in domain check .
// checkdnsrr function reference : http://www.php.net/manual/en/function.checkdnsrr.php
if ( checkdnsrr ( $Domain, "MX" ) ) {
if($Debug) echo "Confirmation : MX record about {$Domain} exists.<br>";
// If MX record exists, save MX record address.
// getmxrr function reference : http://www.php.net/manual/en/function.getmxrr.php
if ( getmxrr ($Domain, $MXHost)) {
if($Debug) {
echo "Confirmation : Is confirming address by MX LOOKUP.<br>";
for ( $i = 0,$j = 1; $i < count ( $MXHost ); $i++,$j++ ) {
echo "Result($j) - $MXHost[$i]
<BR>";
}
}
}
// Getmxrr function does to store MX record address about $Domain in arrangement form
to $MXHost.
// $ConnectAddress socket connection address.
$ConnectAddress = $MXHost[0];
}
else {
// If there is no MX record simply @ to next time address socket connection do .
$ConnectAddress = $Domain;
if ($Debug) echo "Confirmation : MX record about {$Domain} does not exist.<br>";
}

// fsockopen function reference : http://www.php.net/manual/en/function.fsockopen.php
$Connect = fsockopen ( $ConnectAddress, 25 );

// Success in socket connection
if ($Connect)
{
if ($Debug) echo "Connection succeeded to {$ConnectAddress} SMTP.<br>";
// Judgment is that service is preparing though begin by 220 getting string after
connection .
// fgets function reference : http://www.php.net/manual/en/function.fgets.php
if ( ereg ( "^220", $Out = fgets ( $Connect, 1024 ) ) ) {

// Inform client's reaching to server who connect.
fputs ( $Connect, "HELO $HTTP_HOST\r\n" );
if ($Debug) echo "Run : HELO $HTTP_HOST<br>";
$Out = fgets ( $Connect, 1024 ); // Receive server's answering cord.

// Inform sender's address to server.
fputs ( $Connect, "MAIL FROM: <{$Email}>\r\n" );
if ($Debug) echo "Run : MAIL FROM: <{$Email}><br>";
$From = fgets ( $Connect, 1024 ); // Receive server's answering cord.

// Inform listener's address to server.
fputs ( $Connect, "RCPT TO: <{$Email}>\r\n" );
if ($Debug) echo "Run : RCPT TO: <{$Email}><br>";
$To = fgets ( $Connect, 1024 ); // Receive server's answering cord.

// Finish connection.
fputs ( $Connect, "QUIT\r\n");
if ($Debug) echo "Run : QUIT<br>";

fclose($Connect);

// Server's answering cord about MAIL and TO command checks.
// Server about listener's address reacts to 550 codes if there does not exist
// checking that mailbox is in own E-Mail account.
if ( !ereg ( "^250", $From ) || !ereg ( "^250", $To )) {
$Return[0]=false;
$Return[1]="${Email} is address done not admit in E-Mail server.";
if ($Debug) echo "{$Email} is address done not admit in E-Mail server.<br>";
return $Return;
}
}
}
// Failure in socket connection
else {
$Return[0]=false;
$Return[1]="Can not connect E-Mail server ({$ConnectAddress}).";
if ($Debug) echo "Can not connect E-Mail server ({$ConnectAddress}).<br>";
return $Return;
}
$Return[0]=true;
$Return[1]="{$Email} is E-Mail address that there is no any problem.";
return $Return;
}
?>

http://mailzine.hellophp.com/test/mail_example_en.html



validateEmail 2.0 - upgraded version of the old validateEmail function used to validate email addresses via SMTP and regex.
Categories : Email, Regexps, PHP
making links from text
Categories : PHP, Regexps, Email
EAvalidator - This class can be used to validate an e-mail address by checking its domain.
Categories : PHP, PHP Classes, Email, Regexps
email validator check checker email e-mail email address
Categories : PHP, Email, Regexps
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
String Replacement and speed consideration
Categories : PHP, Strings, Regexps
PHP Youtube Downloader - This is a set of PHP functions that can be used to download movies from Youtube.com.
Categories : PHP, CURL, Regexps
Example of function to send out email if error occurs
Categories : PHP, Email, Debugging, Errors and Logging
Newbie Notes #7 - Ridiculous regex
Categories : PHP, Beginner Guides, Regexps
cPanel Email Accounts Creator
Categories : PHP, PHP Classes, Email, Form Processing, Web Services
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
Broadcast HTML Email
Categories : PHP, Email, MySQL, Databases
Email attachment code
Categories : PHP, Email, Filesystem
Tag content retrieval from websites with preg_match
Categories : PHP, Regexps, Arrays, HTML and PHP
Mail-lib provides a simple interface to the sendmail program. Note: you must actually have sendmail on your machine (sorry windows NT users).
Categories : Algorithms, Email, PHP