主题:phpnew关于表单反馈的问题
当我发送反馈邮件的时候,会出现下列的警告:“Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in D:\soft\phpnow\htdocs\phpdw\testarea\contact.php on line 22”
该如何解决呢?
代码如下:(有颜色的是line 22)
<?php
if (array_key_exists('ewcomments',$_POST)) {
//mail processing script
//initialize variable
// remove escape characters from POST array
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
}$to='me@example.com';//use your own emaile address
$subject='Freeback from East-East Seasons';
//build the massage
$massage='From:'.$_POST['name']."\n\n";
$massage.='Email:'.$_POST['email']."\n\n";
$massage.='Comments:'.$_POST['message'];
//build the additional headers
$additionalHeaders="From:E-W Seasons<feedback@example.com>\r\n";
$additionalHeaders.='Reply-To:'.$_POST['email'];
//send the email
[color=FF00FF]mail($to,$subject,$message);}[/color]
?>
该如何解决呢?
代码如下:(有颜色的是line 22)
<?php
if (array_key_exists('ewcomments',$_POST)) {
//mail processing script
//initialize variable
// remove escape characters from POST array
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
}$to='me@example.com';//use your own emaile address
$subject='Freeback from East-East Seasons';
//build the massage
$massage='From:'.$_POST['name']."\n\n";
$massage.='Email:'.$_POST['email']."\n\n";
$massage.='Comments:'.$_POST['message'];
//build the additional headers
$additionalHeaders="From:E-W Seasons<feedback@example.com>\r\n";
$additionalHeaders.='Reply-To:'.$_POST['email'];
//send the email
[color=FF00FF]mail($to,$subject,$message);}[/color]
?>