"E-Mail Probe does not consider mx priorities"
pull/1/head
Wytze van der Raay 10 years ago
parent 8477354c33
commit 2ca78a2eb2

@ -538,20 +538,35 @@
if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\+\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\+\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email))
{ {
list($username,$domain)=explode('@',$email,2); list($username,$domain)=explode('@',$email,2);
$dom = escapeshellarg($domain); $mxhostrr = array();
$line = trim(shell_exec("dig +short MX $dom 2>&1")); $mxweight = array();
#echo $email."-$dom-$line-\n"; if( !getmxrr($domain, $mxhostrr, $mxweight) ) {
#echo shell_exec("dig +short mx heise.de 2>&1")."-<br>\n"; $mxhostrr = array($domain);
$mxweight = array(0);
$list = explode("\n", $line); } else if ( empty($mxhostrr) ) {
foreach($list as $row) { $mxhostrr = array($domain);
if(!strstr($row, " ")) { $mxweight = array(0);
continue; }
$mxhostprio = array();
for($i = 0; $i < count($mxhostrr); $i++) {
$mx_host = trim($mxhostrr[$i], '.');
$mx_prio = $mxweight[$i];
if(empty($mxhostprio[$mx_prio])) {
$mxhostprio[$mx_prio] = array();
}
$mxhostprio[$mx_prio][] = $mx_host;
}
array_walk($mxhostprio, function(&$mx) { shuffle($mx); } );
ksort($mxhostprio);
$mxhosts = array();
foreach($mxhostprio as $mx_prio => $mxhostnames) {
foreach($mxhostnames as $mx_host) {
$mxhosts[] = $mx_host;
} }
list($pri, $mxhosts[]) = explode(" ", trim($row), 2);
} }
$mxhosts[] = $domain;
array_walk($mxhosts, function(&$mx) { $mx = trim($mx, '.'); } );
foreach($mxhosts as $key => $domain) foreach($mxhosts as $key => $domain)
{ {

Loading…
Cancel
Save