1.表单邮件 feedback.html
<html>
<head><title>Bob's Auto Parts - Customer Feedback</title></head>
<body>
<h1>Customer Feedback</h1>
<p>Please tell us what you think.</p>
<form action="processfeedback.php" method="post">
<p>Your name:<br/>
<input type="text" name="name" size="40" /></p>
<p>Your email address:<br/>
<input type="text" name="email" size="40" /></p>
<p>Your feedback:<br/>
<textarea name="feedback" rows="8" cols="40" wrap="virtual" /></textarea></p>
<p><input type="submit" value="Send feedback" /></p>
</form>
</body>
</html>
2. processfeedback.php
<?php
//create short variable names
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$feedback = trim($_POST['feedback']);
//set up some static information
$toaddress = "user1@anyone.com";
$subject = "Feedback from web site";
$mailcontent = "Customer name: ".$name."\n".
"Customer email: ".$email."\n".
"Customer comments:\n".$feedback."\n";
$fromaddress = "From: webserver@example.com";
//invoke mail() function to send mail
mail($toaddress, $subject, $mailcontent);
?>
<html>
<head>
<title>Bob's Auto Parts - Feedback Submitted</title>
</head>
<body>
<h1>Feedback submitted</h1>
<p>Your feedback (shown below) has been sent.</p>
<p><?php echo nl2br($mailcontent); ?> </p>
</body>
</html>
3.登录squirrelmail 查看user1邮件