![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
|
|||||
|
Регистрация: Nov 2001
Адрес: Орёл
Сообщений: 250
|
Привет!
Нашел поиском обсуждение про проверку валидности почты.. там был хороший скрипт.. вот он: <?
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 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 : <a href="http://www.php.net/manual/en/function.list.php" target="_blank">http://www.php.net/manual/en/function.list.php</a>
// split function reference : <a href="http://www.php.net/manual/en/function.split.php" target="_blank">http://www.php.net/manual/en/function.split.php</a>
list ( $Username, $Domain ) = split ("@",$Email);
// That MX(mail exchanger) record exists in domain check .
// checkdnsrr function reference : <a href="http://www.php.net/manual/en/function.checkdnsrr.php" target="_blank">http://www.php.net/manual/en/function.checkdnsrr.php</a>
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 : <a href="http://www.php.net/manual/en/function.getmxrr.php" target="_blank">http://www.php.net/manual/en/function.getmxrr.php</a>
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 : <a href="http://www.php.net/manual/en/function.fsockopen.php" target="_blank">http://www.php.net/manual/en/function.fsockopen.php</a>
$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 : <a href="http://www.php.net/manual/en/function.fgets.php" target="_blank">http://www.php.net/manual/en/function.fgets.php</a>
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;
}
?>
........
<?
echo "starting check function...";
$ret=SnowCheckMail("super@architects.ru",true);
echo $ret[1];
?>
он почему-то доходит до вывода mx-записей, которые вернулись в массив mxhosts[] из getmxrr.. потом он должен попытаться соединиться с 25 портом хоста, или хотябы написать, что соединение не прошло... а он - зараза, нихрена дяльше не делает.. даже после выполнения функции ничего не выводит.. какие будут мнения?
__________________
зеркалась маша нее..тся зе...лась маша зарекаться.. |
|
|||||
|
Регистрация: Jun 2001
Адрес: Москва
Сообщений: 166
|
на мой взгляд в данном деле, очень нужен драйвер прямые руки - я тебе уже писал, просто стучись
__________________
Если что-то может случиться... оно обязательно произойдет |
![]() |
Часовой пояс GMT +4, время: 13:08. |
|
|
« Предыдущая тема | Следующая тема » |
|
|