getmxrr

Get MX records corresponding to a given Internet host name

Syntax

getmxrr ( string $hostname , array &$mxhosts [, array &$weight ] ) : bool

Parameters

hostname

The Internet host name.

mxhosts

A list of the MX records found is placed into the array mxhosts.

weight

If the weight array is given, it will be filled with the weight information gathered.

Return

Returns TRUE if any records are found; returns FALSE if no records were found or if an error occurred.

Examples

1 · hostname mxhosts

<?

$hostname = 'php.net';

$return = getmxrr($hostname, $mxhosts);

echo $return . PHP_EOL;
print_r($mxhosts);

?>
1
Array
(
    [0] => php-smtp4-ip4.php.net
)

2 · weight

<?

$hostname = 'php.net';

$return = getmxrr($hostname, $mxhosts, $weight);

echo $return . PHP_EOL;
print_r($mxhosts);
print_r($weight);

?>
1
Array
(
    [0] => php-smtp4-ip4.php.net
)
Array
(
    [0] => 0
)
HomeMenu