0

情况: 我们的客户(domain.com 的所有者)已将 www.domain.com 的 A 记录设置为我们在 domain.com 后面运行网站的其中一台服务器的 IP 地址。我们只为这个域提供托管,他们有自己的电子邮件服务器。

这意味着 domain.com 的 IP 不是 domain.com 的邮件服务器。

问题: 从 PHP 向 foo@bar.com 发送邮件可以工作,但是向 *@domain.com 发送邮件不起作用。

问题: 这是否与 SPF 记录有关?我该如何解决这个问题?

谢谢

邦迪

4

3 回答 3

1

这发生在我的共享主机上,可能是因为网络服务器上存在本地传递机制,即当您的网络服务器看到@domain.com 的电子邮件时,它假定它将是处理的,并且不会传递到实际的邮件服务器。

进入您的网络服务器的面板(Cpanel 或其他)并检查该域的电子邮件设置。确保对 domain.com 禁用“本地交付”或类似功能

于 2012-05-26T07:12:26.977 回答
0

您的主要 domain.com(没有 www.)是否有 CNAME 记录?这将自动将域的 mx 记录引用到 cname 记录。

MX 记录的特征负载信息是邮件主机的完全限定域名和首选项值。主机名必须直接映射到 DNS 中的一个或多个地址记录(A 或 AAAA),并且不得指向任何 CNAME 记录。

http://en.wikipedia.org/wiki/MX_record#cite_note-0

于 2012-05-25T14:02:51.950 回答
0

发送电子邮件的最佳方式是使用 smtp 方法:

http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php4/0.90/

示例文件:

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "mail.example.net";  // specify main and backup server
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "user@example.net";  // SMTP username
$mail->Password = "password"; // SMTP password

$mail->From = "example@example.net";
$mail->FromName = "Mailer";
$mail->AddAddress("destiny@example.net");


//$mail->AddReplyTo("info@example.com", "Information");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
    echo "Message could not be sent. <p>";
    echo "Mailer Error: " . $mail->ErrorInfo;
    exit;
}

echo "Message has been sent";
?>
于 2012-05-25T14:56:34.360 回答