NYCPHP Meetup

NYPHP.org

[nycphp-talk] sendmail and php mail

Mark Armendariz enolists at gmail.com
Thu Jan 4 14:23:04 EST 2007


Happy 2007, everyone.

I know this isn't directly a php, issue, but I was hoping someone here might
have some experience with such a thing.

My client has their site on one server and their their email server at
another hosting company.  I'm trying to send mail from a php script (using
the mail function) on the site.

I know sendmail is working correctly, as I can send email to my own domain
as well as to any other I've tried.  This only applies to sending email
internally.

Sendmail has a recipient check.  Basically, it talks to the recipient's
server and checks that the user exists before trying to send the message.
Unfortunately, since the hosting server has the same domain name as the mail
server.

** Here's the php:

$aHeaders = array();
$aHeaders[] = 'From: ' . EMAIL_DONATIONS;
$aHeaders[] = 'X-Mailer: PHP v' . phpversion();

$sSubject = 'New Donation Submitted';
$sMessage = 'A new donation has been submitted through the site.';
mail(EMAIL_DONATIONS, $sSubject, $sMessage, implode("\n", $aHeaders), '-v');




** Here's the verbose output of sendmail (with my domain in place of the
client's)

TheRecipient at enobrev.com... Connecting to localhost.localdomain. via relay...
220 ss07.shared.server-system.net ESMTP Sendmail
8.12.11.20060308/8.12.11; Thu, 4 Jan 2007 11:09:10 -0800
>>> EHLO laco.org
250-ss07.shared.server-system.net Hello localhost.localdomain
[127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 15000000
250-DSN
250-ETRN
250-AUTH LOGIN PLAIN
250-STARTTLS
250-DELIVERBY
250 HELP
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO enobrev.com
250-ss07.shared.server-system.net Hello localhost.localdomain
[127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 15000000
250-DSN
250-ETRN
250-AUTH LOGIN PLAIN
250-DELIVERBY
250 HELP
>>> MAIL From:<enobrev at enobrev.com> SIZE=300 AUTH=enobrev at enobrev.com
250 2.1.0 <enobrev at enobrev.com>... Sender ok
>>> RCPT To:<TheRecipient at enobrev.com>
>>> DATA
550 5.1.1 <TheRecipient at enobrev.com>... User unknown
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
dead.letter... Saved message in dead.letter
Closing connection to localhost.localdomain.
>>> QUIT
221 2.0.0 ss07.shared.server-system.net closing connection



Now, I know for a fact the recipient's email exists on my client's mail
server (which is an exchange server).  The only thing I can figure is that
it's checking the local host for the recipient and not finding it, and hence
never sending the email.

Anybody ever run into this before?  Is there a switch i can use with php's
mail function or sendmail to get around this?

Thanks!!

Mark Armendariz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070104/36f893bb/attachment.html>


More information about the talk mailing list