簡體   English   中英

通過PHP郵件功能未在Gmail電子郵件ID上收到的郵件:saett.mishra@atlascorps.org

[英]Mails not received on Gmail Email ID: saket.mishra@atlascorps.org through PHP Mail Function

我正在使用以下代碼發送注冊的電子郵件。

$recmail = 'saket.mishra@atlascorps.org'; // address you want the form mailed to
    $sub = "Atlas Corps Questionnaire"; //subject of email that is sent
    $mess = "Hello, Please fill a questionnaire at following link. ";

    $headers = "From: Atlas Corps Family Tree  < info@atlascorps.org > \n" . 
               "MIME-Version: 1.0\n" .
               "Content-type: text/html; charset=iso-8859-1";

    mail($recmail,$sub,$mess,$headers);

我的saett.mishra@atlascorps.org是有效的Gmail帳戶。 但是我在這里沒有收到任何電子郵件。 我已經正確檢查了我所有的gmail設置。 沒有應用轉發和過濾。

和我的其他Gmail帳戶一樣:saett.me@gmail.com正在通過該網站接收所有電子郵件。

請幫忙,因為我所有的客戶都會在Gmail上擁有@ atlascorps.org電子郵件帳戶。

在服務器的電子郵件日志中,存在以下消息

Return-path: <>
Envelope-to: atlascorpsadmin@p3plcpnl0096.prod.phx3.secureserver.net
Delivery-date: Tue, 23 Sep 2014 08:56:11 -0700
Received: from mailnull by p3plcpnl0096.prod.phx3.secureserver.net with local (Exim 4.82)
    id 1XWSRn-0003Fc-2A
    for atlascorpsadmin@p3plcpnl0096.prod.phx3.secureserver.net; Tue, 23 Sep 2014 08:56:11 -0700
X-Failed-Recipients: saket.mishra@atlascorps.org
Auto-Submitted: auto-replied
From: Mail Delivery System <Mailer-Daemon@p3plcpnl0096.prod.phx3.secureserver.net>
To: atlascorpsadmin@p3plcpnl0096.prod.phx3.secureserver.net
Subject: Mail delivery failed: returning message to sender
Message-Id: <E1XWSRn-0003Fc-2A@p3plcpnl0096.prod.phx3.secureserver.net>
Date: Tue, 23 Sep 2014 08:56:11 -0700

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  saket.mishra@atlascorps.org


------ This is a copy of the message, including all the headers. ------

Return-path: <atlascorpsadmin@p3plcpnl0096.prod.phx3.secureserver.net>
Received: from atlascorpsadmin by p3plcpnl0096.prod.phx3.secureserver.net with local (Exim 4.82)
    (envelope-from <atlascorpsadmin@p3plcpnl0096.prod.phx3.secureserver.net>)
    id 1XWSRm-0003FX-Vo
    for saket.mishra@atlascorps.org; Tue, 23 Sep 2014 08:56:11 -0700
To: saket.mishra@atlascorps.org
Subject: Atlas Corps Questionnaire
X-PHP-Script: atlascorps.org/globe/send_link.php for 122.176.7.34
X-PHP-Originating-Script: 209330:send_link.php
From: Atlas Corps Family Tree  < info@atlascorps.org > 
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
Message-Id: <E1XWSRm-0003FX-Vo@p3plcpnl0096.prod.phx3.secureserver.net>

Hello

我建議您檢查DNS設置,主要是檢查擁有的SPF記錄。 如果您使用kitterman工具進行SPF檢查 ,則會看到您的SPF記錄似乎無效:

Input accepted, querying now...
evaluating v=spf1 a mx ptr include:secureserver.net ~all ...
Results - PermError SPF Permanent Error: Too many DNS lookups

我的猜測是Google有時無法解析所有secureserver.net記錄,因此會退回一些消息。 include:secureserver.net嘗試刪除它並設置指向您服務器的MX記錄,而不要使用include:secureserver.net SPF記錄設置為允許所有MX記錄發送電子郵件,因此應該可以正常工作。

另外,我建議使用諸如SwiftMailer之類的郵件程序庫,它比默認的php mailer函數更易於維護和調試。 這是一個代碼段代碼,可以幫助您快速入門:

require_once '/path/to/swift-mailer/lib/swift_init.php';

// Create the message
// http://swiftmailer.org/docs/messages.html
$message = Swift_Message::newInstance();
$message->setFrom('info@atlascorps.org', 'Atlas Corps Family Tree');
$message->setTo('saket.mishra@atlascorps.org');
$message->setContentType('text/html');
$message->setCharset('iso-8850-1');
$message->setSubject('Atlas Corps Questionnaire');
$message->setBody('<html><head></head><body>Hello, Please fill a questionnaire at following <a href="http://domain.com/link.php?time='.time().'">link</a>.</body></html>');


// Create the Transport
// http://swiftmailer.org/docs/sending.html#the-smtp-transport
$transport = Swift_SmtpTransport::newInstance('localhost', 25);

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);

希望這可以幫助。

您的郵件服務器(exim)將具有日志文件,可能位於/var/log/mail/log或附近,並且這將詳細說明為什么傳遞失敗。 不幸的是,您發布的退信不包含任何有用的信息。

擴展tftd的答案:

RFC4408限制了10個查詢。 有SPF查詢計數一個很好的分析在這里 SPF中的killer子句是mx因為它列出了5個郵件服務器。 secureserver.net的SPF記錄僅包含ip4子句,因此不會引起任何其他查找。 在SPF中,您實際上不需要ptr (而且您也沒有DNS條目),這樣可以節省查找的時間,並且由於您a記錄只是單個IP​​,因此,首先明確列出。 我建議您將SPF更改為此,以最大程度地減少查找次數:

v=spf1 ip4:192.186.207.194 include:secureserver.net mx a ~all

我已經離開了a在那里如果你改變你的IP忘記更新這一紀錄...

話雖如此,這並不一定意味着您的SPF會阻止傳遞,因為郵件服務器在找到匹配項時會停止檢查檢查SPF條目,並且如果它與您的MX中的一個相匹配,則將早於查找限制。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM