0

I am using following code to send email whosoever registers.

$recmail = '[email protected]'; // 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  < [email protected] > \n" . 
               "MIME-Version: 1.0\n" .
               "Content-type: text/html; charset=iso-8859-1";

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

My [email protected] 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: [email protected] 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: [email protected]
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 [email protected]; Tue, 23 Sep 2014 08:56:11 -0700
X-Failed-Recipients: [email protected]
Auto-Submitted: auto-replied
From: Mail Delivery System <[email protected]>
To: [email protected]
Subject: Mail delivery failed: returning message to sender
Message-Id: <[email protected]>
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:

  [email protected]


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

Return-path: <[email protected]>
Received: from atlascorpsadmin by p3plcpnl0096.prod.phx3.secureserver.net with local (Exim 4.82)
    (envelope-from <[email protected]>)
    id 1XWSRm-0003FX-Vo
    for [email protected]; Tue, 23 Sep 2014 08:56:11 -0700
To: [email protected]
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  < [email protected] > 
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1
Message-Id: <[email protected]>

Hello
Piyush aggarwal
  • 750
  • 2
  • 14
  • 25

2 Answers2

1

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('[email protected]', 'Atlas Corps Family Tree');
$message->setTo('[email protected]');
$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.

carlspring
  • 31,231
  • 29
  • 115
  • 197
tftd
  • 16,203
  • 11
  • 62
  • 106
1

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.

Community
  • 1
  • 1
Synchro
  • 35,538
  • 15
  • 81
  • 104