Email from php being rejected by

Hi all,

I have a problem whereby emails generated by php are being rejected by They don’t even find their way into the Junk folder - they just don’t arrive. And we don’t get any rejection message back from

The server’s hostname is and the from address is Therefore I have added as an allowed domain within the SPF record for

When I send an email from a mail client (in this case Mac Mail) authenticating through postfix as, the message arrives at no problem. But when php is the sender, it never gets there.

Even if the user adds to their trusted senders, that makes no difference.

(This is not a php problem, as its message to anything other than arrive no problem.)

This is causing real headaches as we have 245,000 users and no-one can reset their password if they are at a, or address (which is a good proportion of those users).

There’s obviously something about these php generated emails that doesn’t like. Anyone have any ideas as to how I could troubleshoot what it is?


Well, let’s start here… if you look in the email logs – either /var/log/mail.log or /var/log/maillog, what do you see in there during the delivery process? Is the remote mail server offering any errors?

Or does it show them accepting the email?


Hi Eric,

I see this:

May 27 16:14:01 server56938 postfix/sendmail[3144]: fatal: irbpassport(501): No recipient addresses found in message header

So to clarify, if I run the php script with my email address as the recipient, I receive the email no problem. In the mail log, I see:

May 27 16:13:55 server56938 postfix/pickup[1448]: C670C2486983: uid=501 from=<irbpassport>
May 27 16:13:55 server56938 postfix/cleanup[3139]: C670C2486983: message-id=<>
May 27 16:13:55 server56938 postfix/qmgr[19035]: C670C2486983: from=<>, size=1335, nrcpt=1 (queue active)
May 27 16:13:56 server56938 postfix/smtp[3143]: C670C2486983: to=<>,[]:25, delay=0.4, delays=0.25/0/0.06/0.08, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as B19B82A0D94)
May 27 16:13:56 server56938 postfix/qmgr[19035]: C670C2486983: removed

When I run it with a or address, I get the error.

Any thoughts?

Hmm, that’s an unusual error… so just to clarify, you’re saying that if you were to send that to, say, a address, that it correctly arrives in that Gmail account?


Well, it ends up in spam folder, which is something I’d like to solve in the long term… but for now, yes, it gets there.


Well, it’s tough to say exactly why this is the case, but the error you’re seeing seems to suggest that there’s something malformed in the headers in certain cases.

Is it possible to get a copy of the email that it’s generating when sending to the site?

For example, is there maybe a debug setting that shows the entire email contents?


OK - thanks Eric. When running the same site on a testing server with error reporting turned on, I now realize that the particular address I was testing with returned two rows from my database, resulting a malformed header.

OK so that’s that problem parked. Now I’ll start a new thread about what the original problem was - that of getting message into the user’s inbox and avoiding being marked as spam.