我正在尝试使用php发送电子邮件。
public function email($to, $title, $message){
$from = "me@mysite.com";
$headers = "From: {$from}\r\n";
$headers .= "X-Confirm-Reading-To: {$from}\r\n";
$headers .= "Reply-To: {$from}\r\n";
$headers .= "Organization: InfiniSys, inc.\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=ISO-8859-1\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n";
$subject = $title;
mail($to, $subject, $message, $headers);
}
邮件发送;但是,gmail给我一个错误。 “Gmail无法验证mysite.com是否实际发送了此邮件(而非垃圾邮件发送者)”。
SPF记录:(我不知道这是什么)
SPF record lookup and validation for: rrh.com
SPF records are published in DNS as TXT records.
The TXT records found for your domain are:
v=spf1 include:spf.protection.outlook.com a:mailman1-eqix-sjo.packet8.net a:mailman1-eq.packet8.net -all
google-site-verification=GDHGdTnww1rIsh46Zd-n7I-E6d6Fa1n83XZ0ppfx4e8
MS=ms49526710
google-site-verification=-O2gI7Ji-rmEFlZQq8d85jHef7bEk0UcDXt-6MW419I
Checking to see if there is a valid SPF record.
Found v=spf1 record for rrh.com:
v=spf1 include:spf.protection.outlook.com a:mailman1-eqix-sjo.packet8.net a:mailman1-eq.packet8.net -all
evaluating...
SPF record passed validation test with pySPF (Python SPF librar
答案 0 :(得分:0)
它与您的代码无关。如果您以me@mysite.com
发送邮件,则需要在mysite.com
域的SPF记录中发送服务器IP主机名,以告知Gmail和其他邮件服务器,您的服务器可以发送{{1}的邮件域。
因此,您应该更新当前的DNS记录:
mysite.com
包括您的服务器主机名:
v=spf1 include:spf.protection.outlook.com a:mailman1-eqix-sjo.packet8.net a:mailman1-eq.packet8.net -all
希望这有帮助