发邮件问题!

chaiyanlin 2010-04-05 08:51:50
我就不明白了,完全按照手册写的!!!!老出现
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>";
}
?>
...全文
747 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
餅餅 2010-04-05
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 chaiyanlin 的回复:]
不太懂,
是这个吗
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "s……
[/Quote]
;sendmail_from = me@example.com
把前面的分号去掉 后面改成你的邮箱地址 重启Apache
chaiyanlin 2010-04-05
  • 打赏
  • 举报
回复
不太懂,
是这个吗
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; 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 =
餅餅 2010-04-05
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 chaiyanlin 的回复:]
不懂。。。
我现在该怎么办
[/Quote]
去php.ini文件中搜下 sendmail_from
;sendmail_from = postmaster@localhost
chaiyanlin 2010-04-05
  • 打赏
  • 举报
回复
不懂。。。
我现在该怎么办
餅餅 2010-04-05
  • 打赏
  • 举报
回复
php mail使用 需要在php.ini中进行配置
sendmail_from
Windows 专用:规定从 PHP 发送的邮件中使用的 "from" 地址。

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧