/** Sends directly to the Recipient MX, using $rctp MX for their domain @param $rcpt = Recipeint @param $from Sender (MAIL FROM) @param $mail the Message Body */ static function sendMX($from, $rcpt, $mail) { $ret = array(); $res = self::getMX($rcpt); $mxs = array_keys($res); $sent = false; while ($sent == false) { // foreach ($res as $host) { $host = array_shift($mxs); $smtp = new self("tcp://{$host}:25"); if ($res = $smtp->ehlo()) { $ret = array_merge($ret, $res); } if ($res = $smtp->mailFrom($from)) { $ret = array_merge($ret, $res); } if ($res = $smtp->rcptTo($rcpt)) { $ret = array_merge($ret, $res); } if ($res = $smtp->data($mail)) { $ret = array_merge($ret, $res); } if ($res = $smtp->quit()) { $ret = array_merge($ret, $res); } $sent = true; } return $ret; }