PHP mail() function. Help please...
| From: | Anthony Ritter | Date: | Mon, 19 Nov 2001 00:07:05 +0000 |
| Subject: | PHP mail() function. Help please... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75039@lists.php.net to get a copy of this message | ||
I'm reading J.Meloni's tutorial on page 119 in "Fast and Easy" and she is
explaining using the PHP mail function.
There are two scripts for this example...
One is the .html file which lays out the form with input boxes, a textarea
box and a submit button.
It is:
<HTML>
<HEAD>
<TITLE> Simple Feedback Form </TITLE>
</HEAD>
<BODY>
<FORM METHOD="post" ACTION="send_simpleform.php">
<P> <strong> Your name: </strong> <br>
<INPUT TYPE="text" NAME="sender_name" SIZE=30></P>
<P> <strong> Your e-mail address: </strong> <br>
<INPUT TYPE="text" NAME="sender_email" SIZE=30></P>
<P> <strong> Your message: </strong> <br>
<TEXTAREA NAME ="message" COLS=30 ROWS=5 WRAP=virtual></TEXTAREA></P>
<P> <INPUT TYPE="submit" NAME= "submit" VALUE="Send this
form"> </P>
</FORM>
</BODY>
</HTML>
........................................................
The next is the PHP script which reads as follows:
<?
$msg="This e-mail is being sent from www site\n";
$msg.="Sender's name: \t$sender_name\n";
$msg.="Sender's e-mail:\t$sender_email\n";
$msg.="Message:\t$message\n\n";
$to="tony@gonefishingguideservice.com";
$subject="Website Feedback";
$mailheaders="From: My website<> \n";
$mailheaders.="Reply to: $sender_email\n\n";
mail($to,$subject,$msg,$mailheaders);
?>
<HTML>
<HEAD>
<TITLE>Simple Feedback Form</TITLE>
</HEAD>
<BODY>
<H1>The following e-mail has been sent:</H1>
<P><strong>Your Name:</strong><br>
<?echo "$sender_name";?>
<P><strong>Your email address:</strong><br>
<?echo "$sender_email";?>
<P><strong>Message:</strong><br>
<? echo "$message"; ?>
</BODY>
</HTML>
..............................................
Everytime I input a name, e-mail, and test blurb for the message box form
and hit submit, I get:
Warning: Failed to connect in C:\Program Files\Apache
Group\Apache\htdocs\send_simpleform.php
in line 10.
I have made the corrections in my php.ini file in the [mail function]
to read as follows:
SMTP=localhost
sendmail_from=tony@gonefishingguideservice.com
Please advise if anyone knows what I am doing wrong.
Thanking all in advance.
Tony Ritter