0

我正在尝试使用下面的 php 脚本从外部服务器发送邮件:

<?php
$recipient="dwqchen@gmail.com"; 
$subject="Website to customer";
$message="Customer Name: ".$_POST['name']."\r\n";
$message.="Customer Email: ".$_POST['email']."\r\n";
$message.="Customer Message: ".$_POST['msg']."\r\n"; 
$mailheader="From: <maria@comcast.net> \r\n";
$mailheader.="Reply to ".$_POST['email'];
mail($recipient, $subject, $message, $headers);
?>
<!DOCTYPE html>
<html>
<head>
<title>Sending mail from website to Customer</title>
</head>
<body>
<p>Thanks, <strong><?php echo $_POST['name']; ?></strong>, for your message.</p>
<p>Your email address: <strong><?php echo $_POST['email']; ?></strong></p>
<p>Your message: <br/><?php echo $_POST['msg']; ?></p>
</body>
<html>

我收到以下错误消息:

警告:mail() [function.mail]:“sendmail_from”未在 php.ini 中设置或自定义“From:”标头在 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\sendmail 中丢失。第 9 行的 php

我的 php.ini 设置为:

[mail function]
; For Win32 only.
SMTP = smtp.comcast.net
smtp_port = 25

; For Win32 only.
;sendmail_from = maria@comcast.net

谁能告诉我我该怎么办?谢谢。

4

0 回答 0