PHP Classes

Direct Delivery on Windows

Recommend this page to a friend!

      SMTP E-mail sending class  >  All threads  >  Direct Delivery on Windows  >  (Un) Subscribe thread alerts  
Subject:Direct Delivery on Windows
Summary:new getmxrr.php using nslookup
Messages:1
Author:ck miller
Date:2008-11-06 19:36:03
 

  1. Direct Delivery on Windows   Reply   Report abuse  
Picture of ck miller ck miller - 2008-11-06 19:36:03
Replace getmxrr.php with this code if you use direct delivery on a windows server. It doesn't need the old dns.php:

<?php

/*
getmxrr.php

getmxrr for windows workaround using nslookup
see http://php.net/getmxrr
cappac 2008

*/

function GetMXRR( $hostname, &$mxhosts, &$weight ) {
$mxhosts = array();
$weight = array();

if (!empty ($hostname) ) {
$output = "";
@exec ('%SYSTEMDIRECTORY%\\nslookup.exe -q=mx '.escapeshellarg($hostname), $output);
$imx=-1;
foreach ($output as $line) {
$imx++;
$parts = "";
if (preg_match ("/^$hostname\tMX preference = ([0-9]+), mail exchanger = (.*)$/", $line, $parts) ) {
$weight[$imx] = $parts[1];
$mxhosts[$imx] = $parts[2];
}
}
return ($imx!=-1);
}
return false;
}

?>