我就不明白了,完全按照手册写的!!!!老出现
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: [email protected]' . "\r\n";
$to = "[email protected]";
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>";
}
?>
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: [email protected]' . "\r\n";
$to = "[email protected]";
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>";
}
?>
sendmail_from
Windows 专用:规定从 PHP 发送的邮件中使用的 "from" 地址。
;sendmail_from = postmaster@localhost
是这个吗
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25; For Win32 only.
;sendmail_from = [email protected]; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
把前面的分号去掉 后面改成你的邮箱地址 重启Apache