going to try one more time about mail problems
| From: | Wizaerd | Date: | Thu, 01 Jun 2000 14:06:39 +0000 |
| Subject: | going to try one more time about mail problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-792@lists.php.net to get a copy of this message | ||
I have asked this several times and while there have been some cursory
answers, there's been nothing replied or answered that has either explained
this or fixed this. Before you read on though, here are a couple of answers
I'll give outright since they are the only questions everybody asks
imeediately.
1) Yes, the sendmail_path in php.ini has been properly setup.
2) I have included log entries at the bottom of this email and some brief
explanations of what I think occurred.
I can successfully send emails from the command line using sendmail. I
however cannot send emails using PHP's (version 4) mail() function. It
doesn't send any mail if I use this code.
$mailTo = "wizaerd@wizaerd.com";
$mailSubject = "Testing EMail";
$mailBody = "This is a test of the EMail system from a PHP script\n";
$mailBody .= "PHP Version " . phpversion();
$mailHeader = "From: jsheble@zanova.com\n";
$mailHeader .= "Reply-To: jsheble@zanova.comn\n";
$mailHeader .= "X-Mailer: PHP/" . phpversion() . "\n\n";
mail( $mailTo, $mailSubject, $mailBody, $mailHeader );
However, if I use this code it does work:
$MP = "/usr/lib/sendmail -t ";
$fd = popen($MP,"w");
fputs($fd, "To: wizaerd@wizaerd.com\n");
fputs($fd, "From: jsheble@zanova.com\n");
fputs($fd, "Reply-To: jsheble@zanova.com\n");
fputs($fd, "Subject: Test EMail\n");
fputs($fd, "X-Mailer: PHP/".phpversion()."\n\n");
fputs($fd, "This is a test\n");
pclose($fd);
If the one section of code works and the other does not, not to mention
sending mail from the command line works, then most likely it is not a
sendmail configuration problem. I have nbeen told that the second method is
all that sendmail really does behind the scenes for the mail() anyways, but
I was also told that the second approach would be more intensive (CPU
cycles, memory footprints, etc... I dunno why, I just know what I've been
told).
Her are the entries from my /var/log/maillog, and I'm afraid it has not been
very useful to me at all, perhpas someone here can more more sense of it:
The entries that have 'to=wizaerd@wizaerd.com' entry in the log are ones
I've sent from the command line. The ones with 'from=nobody' are the ones
that were tried using a PHP script (the one whose code I included that
didn't work) and the ones with 'from=root' were sent with the popen function
(the code I included that did go through). It looks like it would be a
configuration problem, but if it were, then the command line wouldn't be
working either, right? Nor would the code using the popen method.
May 29 22:41:15 belgarath sendmail[461]: starting daemon (8.9.3):
SMTP+queueing@01:00:00
May 29 22:41:37 belgarath sendmail[579]: WAA00579: from=root, size=21,
class=0, pri=30021, nrcpts=1,
msgid=<200005300541.WAA00579@belgarath.sorcery>, relay=root@localhost
May 29 22:41:37 belgarath sendmail[579]: WAA00579: to=wizaerd@wizaerd.com,
delay=00:00:00, mailer=smtp, stat=queued
May 29 22:41:42 belgarath sendmail[580]: WAA00579: to=wizaerd@wizaerd.com,
ctladdr=root (0/0), delay=00:00:05, xdelay=00:00:02, mailer=smtp,
relay=mail1.itool.com. [207.113.118.44], stat=Sent (Message received
successfully)
May 29 22:43:00 belgarath sendmail[586]: WAA00586: from=nobody,
size=135,class=0, pri=135, nrcpts=0,
msgid=<200005300543.WAA00586@belgarath.sorcery>, relay=nobody@localhost
May 29 23:01:54 belgarath sendmail[695]: XAA00695: from=nobody, size=163,
class=0, pri=163, nrcpts=0, msgid=<200005300601.XAA00695@belgarath.sorcery>,
relay=nobody@localhost
May 29 23:02:29 belgarath sendmail[701]: XAA00701: from=nobody, size=163,
class=0, pri=163, nrcpts=0, msgid=<200005300602.XAA00701@belgarath.sorcery>,
relay=nobody@localhost
May 29 23:03:01 belgarath sendmail[707]: XAA00707: from=nobody, size=163,
class=0, pri=163, nrcpts=0, msgid=<200005300603.XAA00707@belgarath.sorcery>,
relay=nobody@localhost
May 29 23:05:27 belgarath sendmail[720]: XAA00720: from=nobody, size=163,
class=0, pri=163, nrcpts=0, msgid=<200005300605.XAA00720@belgarath.sorcery>,
relay=nobody@localhost
I'm afraid that if I do not get this rectified, I am going to have to
abandon PHP on this project or even this project altogether.
Thanx
Joseph (Joe) Sheble
a.k.a. Wizaerd
========================================
Wizaerd's Realm
http://www.wizaerd.com
3D Art, ColdFusion, Illustration, Canvas
a little bit of everything...
========================================
ColdFusion Developer
Zanova, Inc.
http://www.ZanovaInc.com
Moving your business forward...
========================================