Having some mail difficulties
| From: | Wizaerd | Date: | Wed, 31 May 2000 05:50:20 +0000 |
| Subject: | Having some mail difficulties | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-681@lists.php.net to get a copy of this message | ||
I've posted this a couple of times on the old PHP3 list, and have had very
little response with the exception of a few willing helpful people. I'm
hoping that some of the experts have migrated to this list and can help me
out.
I can successfully send mail using the command line with sendmail, but it
does nothing using the mail() in PHP. I have verified the sendmail_path in
the PHP.ini is set correctly.
This code does not work:
// mail test - doesn't work
$mailTo = "wizaerd@wizaerd.com";
$mailSubject = "Testing EMail";
$mailBody = "This is a test of the EMail system from php script";
$mailBody .= phpversion();
$mailHeader = "From: jsheble@zanova.com\n";
$mailHeader .= "Reply-To: jsheble@zanova.com\n";
$mailHeader .= "X-Mailer: PHP/" . phpversion() . "\n\n";
mail( $mailTo, $mailSubject, $mailBody, $mailHeader );
However, this code does work:
// secondary mail test - 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);
I was told that using the popen() for mailing was not very efficient, and
I'm not quite sure why one works and the other does not. Does anybody have
any enlightenment?
Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics, ColdFusion
http://www.wizaerd.com
=================================
Zanova, Inc.
http://www.zanova.com
Moving Business Forward.....
=================================