麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > PHP > 正文

php判斷郵件服務提供商的代碼示例

2020-03-22 20:12:51
字體:
來源:轉載
供稿:網友
  • php判斷郵件服務提供商的代碼示例:

    <?php//by Gump http://gump.me/1131.html //www.it165.net//check the valid email address, if ok return the domainfunction validate_email($email){	if(!preg_match("/^[/w/.-]{1,}/@([/da-zA-Z-]{1,}/.){1,}[/da-zA-Z-]+$/", $email))		return false;	list($prefix, $domain) = split("@", $email);	if(function_exists("getmxrr") && getmxrr($domain, $mxhosts)){		return $domain;	}elseif(@fsockopen($domain, 25, $errno, $errstr, 5)){		return $domain;	}else{		return false;	}} // getmxrr() support for Windows// if Linux installed bind-utils, this way is okey too.function re_getmxrr($hostname, &$mxhosts, &$mxweight=false) {	if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') return;	if (!is_array ($mxhosts) ) $mxhosts = array();	if (empty($hostname)) return;	$exec='nslookup -type=MX '.escapeshellarg($hostname);	@exec($exec, $output);	if (empty($output)) return;	$i=-1;	foreach ($output as $line) {		if (preg_match("/^$hostname/tMX preference = ([0-9]+), mail exchanger = (.+)$/i", $line, $parts)) {			$i++;			$mxweight[$i] = trim($parts[1]);			$mxhosts[$i] = trim($parts[2]);		}		if (preg_match('/responsible mail addr = (.+)$/i', $line, $parts)) {			$i++;			$mxweight[$i] = $i;			$mxhosts[$i] = trim($parts[1]);		}	}	return ($i!=-1);} // Defineif (!function_exists('getmxrr')) {    function getmxrr($hostname, &$mxhosts, &$mxweight=false) {        return re_getmxrr($hostname, $mxhosts, $mxweight);    }} function analysis_mail_exchanger($email){	$debug = false;	//$debug = true;	$known_provider = array(		"google_apps" => array(			"aspmx.l.google.com" => 10,			"alt1.aspmx.l.google.com" => 20,			"alt2.aspmx.l.google.com" => 30,			"aspmx2.googlemail.com" => 40,			"aspmx3.googlemail.com" => 50,		),		"google_gmail" => array(			"gmail-smtp-in-v4v6.l.google.com" => 5,			"alt1.gmail-smtp-in.l.google.com" => 10,			"alt2.gmail-smtp-in.l.google.com" => 20,			"alt3.gmail-smtp-in.l.google.com" => 30,			"alt4.gmail-smtp-in.l.google.com" => 40,		),		"microsoft_hotmail" => array(			"mx3.hotmail.com" => 5,			"mx2.hotmail.com" => 5,			"mx1.hotmail.com" => 5,			"mx4.hotmail.com" => 5,		),		"microsoft_domains" => '.hotmail.com',		"yahoo_usa" => array(			"mta7.am0.yahoodns.net" => 1,			"mta6.am0.yahoodns.net" => 1,			"mta5.am0.yahoodns.net" => 1,		),		"yahoo_china" => '.yahoo.com',		"yahoo_biz" => array(			"mx1.biz.mail.yahoo.com" => 20,			"mx5.biz.mail.yahoo.com" => 30,		),		"tencent_qq" => array(			"mx3.qq.com" => 10,			"mx2.qq.com" => 20,			"mx1.qq.com" => 30,		),		"tencent_domains" => array(			"mxdomain.qq.com" => 10,		),		"tencent_exmail" => array(			"mxbiz1.qq.com" => 5,			"mxbiz2.qq.com" => 10,		),		"netease_163" => array(			"163mx01.mxmail.netease.com" => 10,			"163mx03.mxmail.netease.com" => 10,			"163mx02.mxmail.netease.com" => 10,			"163mx00.mxmail.netease.com" => 50,		),		"netease_vip163" => array(			"vip163mx01.mxmail.netease.com" => 10,			"vip163mx00.mxmail.netease.com" => 50,		),		"netease_126" => array(			"126mx02.mxmail.netease.com" => 10,			"126mx01.mxmail.netease.com" => 10,			"126mx00.mxmail.netease.com" => 50,		),		"netease_vip126" => array(			"mx.vip.126.com" => 50,		),		"netease_yeah" => array(			"yeahmx01.mxmail.netease.com" => 10,			"yeahmx00.mxmail.netease.com" => 50,		),		"netease_free" => array(			"mx.mail.ym.163.com" => 10,		),		"netease_qiye" => array(			"qiye163mx02.mxmail.netease.com" => 10,			"qiye163mx01.mxmail.netease.com" => 50,		),		"sina_mail" => array(			"freemx.sinamail.sina.com.cn" => 5,			"freemx3.sinamail.sina.com.cn" => 10,			"freemx2.sinamail.sina.com.cn" => 10,			"freemx1.sinamail.sina.com.cn" => 10,		),		"sina_vip" => array(			"mx3.vip.sina.com" => 5,			"mx2.vip.sina.com" => 10,			"mx1.vip.sina.com" => 10,			"sinamx.vip.sina.com" => 20,		),		"sina_free" => array(			"mx.exmail.sina.com" => 10,		),		"sina_qiye" => '.sina.net',		"sohu_mail" => array(			"sohumx1.sohu.com" => 5,			"sohumx.h.a.sohu.com" => 10,		),		"sohu_vip" => array(			"mx.vip.sohu.com" => 10,		),		"sohu_free" => array(			"mx.mail.sohu.net" => 10,		),	);	if($domain = validate_email($email)){		$result = 'other';		getmxrr($domain, $mxhosts, $mxweight);		for($i=0; $i<count($mxhosts); $i++){			$mxs[strtolower($mxhosts[$i])] = $mxweight[$i];		}		asort($mxs);		//$mxs = array_keys($mxs);		if($debug){			foreach ($mxs as $key => $value) {				echo '"' . $key . '" => ' . $value . ",/r/n";			}			exit();		}else{			foreach ($known_provider as $key => $value) {				if(is_array($value)){					ksort($mxs);					ksort($value);					if($value==$mxs){						$result = $key;						break;					}				}else{  //like as ms live domains					foreach ($mxs as $k => $v) {						if(stristr($k, $value) !== FALSE){							$result = $key;							break;						}						break;  //only once					}				}			}		}	}else{		$result = 'unvalid';	}	return $result;} echo analysis_mail_exchanger('[email protected]');?>

    歡迎各位朋友一起來完善下其他未加入判斷的郵件服務提供商!

    PHP編程

    鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

  • 發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 国产成人精品一区在线播放 | 国产精品久久久久久久久久东京 | 一区二区久久电影 | 久久恋 | 亚洲第一视频 | 久久国产乱子伦精品 | 亚洲一区国产二区 | 日韩精品一区二区三区中文 | 久久久久久久久久久久久久av | 天海翼四虎精品正在播放 | 久久亚洲成人网 | 亚洲福利在线观看视频 | 成人免费看毛片 | 久久久久久麻豆 | 91成人在线免费观看 | 色交视频 | 日日摸夜夜添夜夜添牛牛 | 欧美成人一区二区三区 | 91色琪琪电影亚洲精品久久 | 色污视频在线观看 | 亚洲黑人在线观看 | 黄污在线看 | 免费观看欧美一级片 | 久精品国产 | 黄色欧美精品 | 一级尻逼视频 | 午夜视频在线免费播放 | 多人乱大交xxxxx变态 | 亚洲精品久久久久久久久久 | 激情视频免费观看 | 亚州综合图片 | 欧美大电影免费观看 | 国产乱淫av片免费网站 | 国产精品久久久免费 | 一区二区三区欧美精品 | 他也色在线视频 | 久久亚洲精品国产一区 | 黄色免费av网站 | 精精国产xxxx视频在线播放7 | 色婷婷久久久久久 | 自拍亚洲伦理 |