2016-04-14 219 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

甜,現在我只是想知道我是否應該在服務器故障中詢問此查詢? –