mail function -- not functioning for me!
| From: | Dave Turnbull | Date: | Tue, 18 Jul 2000 20:55:30 +0000 |
| Subject: | mail function -- not functioning for me! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7154@lists.php.net to get a copy of this message | ||
PHP 4.0.1pl2
Mac OS X 1.2
Apache 1.3.12
I have been trying to get a simple mail function to work with PHP -- I want
to use it to create a feedback form, eventually. I copied the code from a
book, and they say it should work. But, of course, it is not. the actuall
code will follow, but I don't think it's an error in the code, because when
I put a deliberate error in, php DOES generate an error message for me.
Otherwise, no error messages.
I think the problem lies in the interaction between PHP and sendmail. The
server tells me sendmail is in /usr/sbin and that it is running. This is the
path I put in the php.ini, on the "sendmail_path =" line. This line is not
commented. I have tried various e-mail send-to addresses, just in case. I
know PHP is tracking vars, because it displays the "thank you" message
correctly. I also, therefore, know that is not a problem of file location,
etc.
**CODE FOR HTML FORM**
<HTML>
<HEAD>
<TITLE>Feedback</TITLE>
</HEAD>
<BODY>
<FORM method="POST" action="/php/sendfeedback.php">
<P>Your Name:<br>
<INPUT type="text" name="sender_name" size=30></p>
<P>Your E-Mail Address:<br>
<INPUT type="text" name="sender_email" size=30></p>
<P>Your Message:<br>
<textarea name="message" cols=30 rows=5></textarea>
</p>
<INPUT type="submit" value="Send This Form">
</FORM>
</BODY>
</HTML>
**END OF HTML CODE**
**CODE FOR PROCESSING SCRIPT**
<?php
$msg = "Sender's Full Name:\t$sender_name\n";
$msg .= "Sender's E-Mail:\t$sender_email\n";
$msg .= "Sender's Message:\t$message\n\n";
// use two newline characters at the end of your content,
// or to insert additional spacing
$mailheaders = "From: ASD Web Site <> \n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail("turnbull@enol.com", "Feedback Form", $msg, $mailheaders);
echo "<H1 align=center>Thank You, $sender_name</h1>";
echo "<p align=center>We appreciate your feedback.</p>";
?>
**END OF PHP SCRIPT**
Any ideas?
Dave