RE: [PHP-GENERAL] going to try one more time about mail problems
| From: | Wizaerd | Date: | Thu, 01 Jun 2000 14:43:00 +0000 |
| Subject: | RE: [PHP-GENERAL] going to try one more time about mail problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-803@lists.php.net to get a copy of this message | ||
The portion under the asterisks was going to be my original response, but
then I decided it sounded too flippant and arrogant. It's just that my
level of frustration has been real regarding this issue since I have not
gotten any closer, and the majority of responses I get are all the same
thing...
Anyways, I tried:
// mail test - doesn't work
$mailTo = "wizaerd@wizaerd.com\n";
$mailSubject = "Testing EMail\n";
$mailBody = "This is a test from mail()\n";
$mailHeader = "From: jsheble@zanova.com\n";
mail( $mailTo, $mailSubject, $mailBody, $mailHeader );
$mailBody = "This is a test from popen()\n";
// secondary mail test - does work
$MP = "/usr/lib/sendmail -t ";
$fd = popen($MP,"w");
fputs($fd, "To: " . $mailTo );
fputs($fd, $mailHeader );
fputs($fd, "Subject: " . $mailSubject );
fputs($fd, $mailBody );
pclose($fd);
Notice the first and second methods use the same variables. The only
difference is that the popen function adds the To: and Subject: in the text
because the mail function does that internally (otherwise all the examples
of mail() I've seen on the internet and in books are wrong because they're
never included when using mail()).
Here are the lines from the /var/log/maillog after trying these two examples
(I tried it twice):
Jun 1 07:37:06 belgarath sendmail[4017]: HAA04017: from=nobody, size=92,
class=0, pri=92, nrcpts=0, msgid=<200006011437.HAA04017@belgarath.sorcery>,
relay=nobody@localhost
Jun 1 07:37:06 belgarath sendmail[4018]: HAA04018: from=nobody, size=87,
class=0, pri=30087, nrcpts=1,
msgid=<200006011437.HAA04018@belgarath.sorcery>, relay=nobody@localhost
Jun 1 07:37:08 belgarath sendmail[4020]: HAA04018: to=wizaerd@wizaerd.com,
ctladdr=nobody (99/99), delay=00:00:02, xdelay=00:00:02, mailer=esmtp,
relay=mail1.itool.com. [207.113.118.44], stat=Sent (Message received
successfully)
Jun 1 07:38:12 belgarath sendmail[4027]: HAA04027: from=nobody, size=104,
class=0, pri=104, nrcpts=0, msgid=<200006011438.HAA04027@belgarath.sorcery>,
relay=nobody@localhost
Jun 1 07:38:12 belgarath sendmail[4028]: HAA04028: from=nobody, size=100,
class=0, pri=30100, nrcpts=1,
msgid=<200006011438.HAA04028@belgarath.sorcery>, relay=nobody@localhost
Jun 1 07:38:15 belgarath sendmail[4030]: HAA04028: to=wizaerd@wizaerd.com,
ctladdr=nobody (99/99), delay=00:00:03, xdelay=00:00:03, mailer=esmtp,
relay=mail1.itool.com. [207.113.118.44], stat=Sent (Message received
successfully)
************************************************************************
************************************************************************
I'm not quite sure what you're advising here. The From, Reply-To and
X-Mailer sections of this email are already exactly the same. The To
portion does not have a newline on it because the mail function claims it
doesn't require one (but just for that sake of argument, I tried adding it
with zero results). Also for the sake of argument, others have said they
took this code precisely as it's listed here, and plugged it into their own
PHP scripts and the mail() portion worked. I have tried sending mail using
simpler examples, with no additional header information, lots of additional
information, variables, literals, and the results have always been the same.
The mail() will not send email. So again it points to my configuration. At
this point, I'm merely looking for an explanation as to why one method
works, the other does not. How can it be a configuration problem if the
command line method and the popen method work?
>
> You never replied to my mail to you asking you to try something..
>
> What happens when you set the mail style part to be exactly the
> same as the
> fputs version?
>
> Your logs show that its trying to send stuff, but not what
> happens with it.
> Thats the From Nobody bit.. its not picking up the right stuff.
>
> Also, try removing the last \n from the header section as it could be
> putting a blank line in the wrong place in the headers and
> upsetting it all.
>
> liz
>
> > -----Original Message-----
> > From: Wizaerd [mailto:wizaerd@wizaerd.com]
> > Sent: Thursday, June 01, 2000 15:07
> > To: General PHP LIst
> > Subject: [PHP-GENERAL] going to try one more time about mail problems
> >
> >
> > 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...
> > ========================================
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net