如何使用getmxrr获取主机名,邮件服务器的IP地址? [英] How to use getmxrr to get the host name, ip address of mail server?

查看:333
本文介绍了如何使用getmxrr获取主机名,邮件服务器的IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从phpmanual,getmxrr(获取mx记录)是一个bool值,如果记录存在,则为true。

From the phpmanual, the getmxrr( get mx record) is a bool value, it is true if the record exist.

但是,我想获得更多有关邮件域的信息,例如:

However, i would like to get more information about the mail domain, for example:

一个简单的mx查找记录(hotmail)就是这样的:

A simple mx lookup record (hotmail) is like this:

Pref    Hostname    IP Address  TTL     
5   mx1.hotmail.com 65.55.92.152    60 min  
5   mx2.hotmail.com 65.55.92.152    60 min  
5   mx3.hotmail.com 65.54.188.110   60 min  
5   mx4.hotmail.com 65.55.92.136    60 min  

我可以使用getmxrr获取上述信息吗?

Can i obtain the above information using getmxrr?

谢谢。

推荐答案

第二个参数给出了mx主机列表:

Second parameter gives mx host list:

$hosts = array();
getmxrr('hotmail.com', $hosts);
var_dump($hosts);

getmxrr

获取和ip地址使用 gethostbyname

 foreach($hosts as $host) {
     echo $host . ' ' . gethostbyname($host) . '<br />';
 }

这篇关于如何使用getmxrr获取主机名,邮件服务器的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆