Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

first try at php and mail()

Status
Not open for further replies.

imarosel

Technical User
Jun 23, 2005
149
US
Never coded in php until today. The following code:

<?php
$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>

produces the following output:

Message successfully sent!

'); } else { echo("

Message delivery failed...
"); } ?>

I grabbed this code off the web. What am I missing?
 
I'd check all the doublequotes and singlequotes on this line:

echo("<p>Message successfully sent!</p>");

to make sure they all balance, etc.



Want the best answers? Ask the best questions! TANSTAAFL!
 
thanks for the response. This was a really newbie error. I was playing around and made my index.php an index.html. Stupid stupid error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top