简体   繁体   中英

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

I am using following code to send email whosoever registers.

$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);

My saket.mishra@atlascorps.org is a valid Gmail Account. But i am not receiving any emails here. I have checked all my setting of gmail properly. No forwarding and filtering is applied.

where as my other Gmail Account: saket.me@gmail.com Is receiving all the emails through this website.

Please help, as all my customers will have the @atlascorps.org email account on Gmail.

On Email Logs of the server, following message is there

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

I would suggest you check your DNS settings and mainly the SPF record you have. If you go to the kitterman tool for SPF checks , you'll see that your SPF record appears to be invalid:

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

My guess is that google is sometimes failing to resolve all secureserver.net records, therefore it's bouncing back some messages. Instead of having include:secureserver.net try removing it and setting an MX record that points to your server. The SPF record is set to allow all MX records to send emails, so that should work fine.

Also, I would suggest using a mailer library such as SwiftMailer , which is quite easier to maintain and debug than the default php mailer function. Here is a snippet code, which can give you a head start:

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);

Hope this helps.

Your mail server (exim) will have log files, probably in /var/log/mail/log or nearby, and this will have more detail about why your deliveries are failing. Unfortunately the bounce you posted doesn't contain any useful information.

Expanding on tftd's answer:

RFC4408 imposes a limit of 10 lookups. There's a good analysis of SPF lookup counting here . The killer clause in your SPF is mx because it lists 5 mail servers. secureserver.net's SPF record only contains ip4 clauses, so will not incur any additional lookups. In the SPF you really don't need ptr (and you don't have a DNS entry for that anyway), so that will save a lookup, and since your a record is only a single IP, it would be a good idea to list that explicitly first. I'd suggest you alter your SPF to this to minimise lookup count:

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

I've left the a in there in case you change your IP and forget to update this record...

All that said, this won't necessarily mean that your SPF is preventing deliveries, since a mail server will stop checking check SPF entries when it finds a match, and if it matches one of your MXs that will be well before the lookup limit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM