PHP mail() not received


#1

Hey all,

General support question (for once xD) - My web application has a cron job that sends email alerts out when necessary, but very recently emails are not being received.

I’ve noticed this before and ignored it as it was only one address not receiving the mail, but now all recipients are not receiving any mails.

There hasn’t been any changes to the cron, and the “from” address is a fully hosted dreamhost inbox.

the mail() function returns true so I’m not sure what else could be wrong.

=S


#2

I would try 2 things first:

I would open a support ticket and ask if there is anything wrong with the server or the outgoing mail queue’s. I haven’t really seen posts about it lately but there was a time that outgoing mail queues got clogged with spam.

Second, if you have a recent email sent by the script verify it’s first (bottom) “received by” header says yourservername.dreamhost.com. then go to this page and put yourservername.dreamhost.com in the search box. (using your own servers name of course =] )

if your server is blacklisted, the quickest remedy is to reconfigure to use smtp to send and use mail.yourdomain.com as the smtp server and the credentials to one of your mail accounts, that will change the outgoing mail server.


#3

Thanks LakeRat I’ll give that a go shortly :slight_smile:


#4

I’ve done the search, but I’m not entirely sure what I’m looking at…
Does this mean the server is blacklisted?


#5

no…

is your php mail() using homie3 tho? If you didn’t configure it to do that, by default the email is most likely originating from YOURWEBSERVER.dreamhost.com Dreamhosts webservers do get blacklisted individually sometimes…


#6

Well, I haven’t configured anything specifically that I’m aware of…
I’m just trying to use PHP’s built in mail() function;

My testing loop –
[php] while ($row = mysql_fetch_assoc($r))
{
$e ++;

      $to = $row['user_email'];
      $headers  = "MIME-Version: 1.0\r\n";
      $headers .= "Content-type: text/html; charset: us-ascii\r\n";
      $headers .= 'To: Friendly Name <' . $row['user_email'] . '>' . "\r\n";
      $headers .= 'From: Friendly Name <INBOX@MYDOMAIN.com>' . "\r\n";
      $subject = 'You have a reminder.';

      if(mail($to, $subject, $email_message, $headers))
      {
        echo "Send success: $to <br />";
      }
      else
      {
        echo "Failed send: $to <br />";
      }
    }[/php]

That’s the only thing sending mail from my cron job.


#7

It should be sending from servername.dreamhost.com not homie3. remember dreamhost physically puts your mail accounts on a mail server. using mail() from within a script will cause the email to originate from the web server. If you still have an email from the script in your mail or trash that the script sent while it was working you can examine the full headers and see.