使用XAMPP发送邮件时出错

时间:2009-10-21 04:22:26

标签: php xampp

嗨,我一直收到错误,

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or 
custom "From:" header missing in C:\xampp\htdocs\

我将php.ini中的sendmail更改为:       sendmail_from = 12343OHBS@gmail.com

  $to='12343OHBS@gmail.com';//assigns the email address to the reciever part of the script
$subject='User Comments OHBS.com';
$header='test';
$name=($_POST['Name']);
$email=($_POST['Email']);
$Question=($_POST['MessageTitle']);
// the mail, the .= function is used to add more elements to the message array
$message="Name: $name\n\n";
$message.="Email: $email\n\n";
$message.="Comment or Question: $Question";
//Wordwrap to limit each line to 100 characters
$message=wordwrap($message, 100);
//Script to send the mail
$mailSent=mail($to,$header,$subject,$message);

请帮忙!

1 个答案:

答案 0 :(得分:0)

确保在xampp中配置了stmp服务器并运行。
尝试将sendmail_from值括在引号

sendmail_from = "from@example.com"