发邮件问题!
我就不明白了,完全按照手册写的!!!!老出现
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\AppServ\www\mail.php on line 15
好像没说一定要有报头吧
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Send Email</title>
</head>
<body>
<form action="mail.php" method="post">
<table>
<tr>
<td>Name</td>
<td><input type="text" size="30" name="name"></td>
</tr>
<tr>
<td>Subject</td>
<td><input type="text" size="30" name="subject"></td></tr>
<tr><td valign="top">Messages</td>
<td><textarea name="Messages" rows="6" cols="30"></textarea></td></tr>
<tr><td> </td><td><input type="submit" value="Send"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
$name = $_POST['name'] ;
$subject = $_POST['subject'];
$Messages = $_POST['Messages'] ;
$headers .= 'Cc: myboss@example.com' . "\r\n";
$to = "1990andy@gmail.com";
if ($Messages=="")
//if "email" is not filled out, display the form
{
echo "<script language=javascript>alert('Nothing in the comments, please make sure the comments is filled out!');history.back();</script>";
}
else
//if "email" is filled out, send email
{
mail('$to', '$subject', '$Messages', '$headers');
echo "<h1><strong>$name, Thank you for your mail!</strong></h1>";
}
?>