getmxrr example

public function testGetmxrr()
    {
        DnsMock::withMockedHosts([
            'example.com' => [[
                'type' => 'MX',
                'host' => 'mx.example.com',
                'pri' => 10,
            ]],
        ]);

        $this->assertFalse(DnsMock::getmxrr('foobar.com', $mxhosts$weight));
        $this->assertTrue(DnsMock::getmxrr('example.com', $mxhosts$weight));
        $this->assertSame(['mx.example.com']$mxhosts);
        $this->assertSame([10]$weight);
    }

    public function testGethostbyaddr()
    {
        DnsMock::withMockedHosts([
            'example.com' => [
                [
                    'type' => 'A',
                    
return $result;
    }

    /** * Internal method to validate the servers MX records * * @return boolean */
    private function _validateMXRecords()
    {
        $mxHosts = array();
        $result = getmxrr($this->_hostname, $mxHosts);
        if (!$result) {
            $this->_error(self::INVALID_MX_RECORD);
        } else if ($this->_options['deep'] && function_exists('checkdnsrr')) {
            $validAddress = false;
            $reserved     = true;
            foreach ($mxHosts as $hostname) {
                $res = $this->_isReserved($hostname);
                if (!$res) {
                    $reserved = false;
                }

                


        return false;
    }

    /** * @return bool */
    public static function getmxrr($hostname, &$mxhosts, &$weight = null)
    {
        if (!self::$hosts) {
            return \getmxrr($hostname$mxhosts$weight);
        }
        $mxhosts = $weight = [];

        if (isset(self::$hosts[$hostname])) {
            foreach (self::$hosts[$hostname] as $record) {
                if ('MX' === $record['type']) {
                    $mxhosts[] = $record['host'];
                    $weight[] = $record['pri'];
                }
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.