Using mail() to redirect user information : mail « Utility Function « PHP






Using mail() to redirect user information

 
//File: index.php
<html>
<head>
<title></title>
</head>
<body>
<?
$form = "
<form action=\"index.php\" method=\"post\">
<input type=\"hidden\" name=\"seenform\" value=\"y\">
<b>Send us your comments!</b><br>
Your Name:<br>
<input type=\"text\" name=\"name\" value=\"\"><br>
Your Email:<br>
<input type=\"text\" name=\"email\" value=\"\"><br>
Your Comments:<br>
<textarea name=\"comments\"></textarea><br>
<input type=\"submit\" value=\"submit!\">
</form>
";
if ($seenform != "y") :
     print "$form";
else :
     $recipient = "y@youremail.com";
     $subject = "User Comments ($name)";
     $headers = "From: $email";
     mail($recipient, $subject, $comments, $headers) or die("Could not send email!");
     print "Thank you $name for taking a moment to send us your comments!";

endif;
?>
</body>
</html>
  
  








Related examples in the same category

1.Add both name and address values into the email address
2.mail() function mails information to a given recipient.
3.mail-javascript.php
4.Encrypting and Sending Secure Emails Using S/MIME
5.send-email-multiple-recipients-2.php
6.send-email-with-headers.php
7.send-mail-multiple-recipients.php
8.send-plaintext-email.php
9.Sending user-requested information
10.Sends a HTML mail from a given email address:
11.Sending Internet Mail
12.Sending Mail
13.Sending a message with mail()