2016-04-14 63 views
-1

我想用PHP发送电子邮件。PHP发送电子邮件GMAIL错误

public function email($to, $title, $message){ 
     $from = "[email protected]"; 
     $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 
+1

其eiter头问题,或者在我结束一个错误配置。我总是谷歌之前,我张贴求助。 –

+0

你的SPF记录是什么样的? – Chris

+0

使用phpmailer代替https://github.com/PHPMailer/PHPMailer –

回答

0

它不相关的代码。如果您要发送邮件为[email protected],则需要在mysite.com域的SPF记录中发送服务器IP主机名,以告知Gmail和其他邮件服务器,您的服务器可以发送邮件给mysite.com域。

所以,你应该更新当前的DNS记录: v=spf1 include:spf.protection.outlook.com a:mailman1-eqix-sjo.packet8.net a:mailman1-eq.packet8.net -all 包括您的服务器的主机名: v=spf1 include:spf.protection.outlook.com a:mailman1-eqix-sjo.packet8.net a:mailman1-eq.packet8.net a:my.server.hostname -all

希望这有助于

+0

我认为这正是我正在寻找的,让我更新我的设置权利neow –

+0

甜,现在我只是想知道我是否应该在服务器故障中询问此查询? –