我很想弄清楚这个问题。主要问题是,当我使用 php mailer 循环来向我们的用户发送电子邮件时,它只会到达一些,我相信这是一个 DNS 问题。
这是邮件代码
function massEmail($from,$subject,$to,$body) {
require_once('packages/class.phpmailer.php');
$success = 0;
foreach($to as $person) {
usleep(2000);
$mail = new PHPMailer();
$mail->From = $from;
$mail->IsHTML(true);
$mail->FromName = "cmiVFX";
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($person);
$ret = $mail->Send();
if($ret) {
$success++;
}
}
var_dump($success);
}
运行主机名时我得到这个
server.cmivfx.com
当运行主机名 -f 或 --fqdn 时,我得到
hostname: Name or service not known
重新启动发送邮件时,我得到
hostname: Name or service not known
这是我的主机文件
127.0.0.1 localhost.localdomain localhost
127.0.1.1 server.cmivfx.com cmivfx.com
69.162.76.226 server.cmivfx.com cmivfx.com
我的主机名文件是
server.cmivfx.com
我的邮件服务器指向谷歌应用所以挖掘 cmivfx.com 任何给我的
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11895
;; flags: qr rd ra; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;cmivfx.com. IN ANY
;; ANSWER SECTION:
cmivfx.com. 1553 IN SOA ns1.limestonenetworks.com. noc.limestonenetworks.com. 1344528611 16384 2048 1048576 2560
cmivfx.com. 1553 IN NS ns1.limestonenetworks.com.
cmivfx.com. 1553 IN NS ns2.limestonenetworks.com.
cmivfx.com. 1544 IN MX 1 ASPMX.L.GOOGLE.com.
cmivfx.com. 1544 IN MX 5 ALT1.ASPMX.L.GOOGLE.com.
cmivfx.com. 1544 IN MX 10 ASPMX2.GOOGLEMAIL.com.
cmivfx.com. 1544 IN MX 10 ASPMX3.GOOGLEMAIL.com.
cmivfx.com. 1544 IN MX 5 ALT2.ASPMX.L.GOOGLE.com.
cmivfx.com. 1519 IN A 69.162.76.226
;; Query time: 0 msec
;; SERVER: 208.115.254.242#53(208.115.254.242)
;; WHEN: Thu Aug 9 11:48:14 2012
;; MSG SIZE rcvd: 268
最后,当我用我的gmail运行邮件php代码时,它很好。和其他一些人一起,我得到了
Could not instantiate mail function
希望我已经提供了足够的信息,了解sendmail的人可以帮助我。非常感谢!
/etc/hosts 和/etc/hostname 之间存在冲突:将/etc/hostname 更改为: cmivfx.com
如果有特殊原因需要将主机名保留为server.cmivfx.com
,您可以使用 /etc/hostname + /etc/resolv.conf let 'hostname -f'
获得正确的 FQDN。
您可能会在此处获得一些背景信息: 在多个域上配置 FQDN 支持邮件服务器