NotifySend.php
authorAlan Knowles <alan@akkbhome.com>
Wed, 6 Apr 2011 15:23:16 +0000 (23:23 +0800)
committerAlan Knowles <alan@akkbhome.com>
Wed, 6 Apr 2011 15:23:16 +0000 (23:23 +0800)
NotifySend.php

index 0be3107..991b8f9 100644 (file)
@@ -82,21 +82,18 @@ class Pman_Core_NotifySend extends Pman
     {
         $mx_records = array();
         $mx_weight = array();
+        $mxs = array();
+        if (!getmxrr($fqdn, $mx_records, $mx_weight)) {
+            return araray($fqdn);
+        }
+        
+        asort($mx_weight)
         
-        if (getmxrr($fqdn, $mx_records, $mx_weight)) {
-            // copy mx records and weight into array $mxs
-            // ignore multiple mx's at the same weight << that's just dumb...
-            for ($i = 0; $i < count($mx_records); $i++) {
-                $mxs[$mx_weight[$i]] = $mx_records[$i];
-            }
-            // sort array mxs to get servers with highest priority
-            ksort ($mxs, SORT_NUMERIC);
-            reset ($mxs);
-        } else {
-            // No MX so use A
-            $mxs[0]= $fqdn;
+        forach($mx_weight as $k => $weight) {
+            $mxs[] = $mx_records[$k];
         }
+        return $mxs;
     }
-    return $mxs;
+    
     
 }
\ No newline at end of file