【问题标题】:Error on sending mail with XAMPP使用 XAMPP 发送邮件时出错
【发布时间】:2009-10-21 04:22:26
【问题描述】:

您好,我一直收到错误消息,

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);

请帮忙!

【问题讨论】:

  • 您是否安装了包含邮件服务器的“大”XAMPP 软件包?如果没有邮件服务器,当您尝试发送电子邮件时,您的 XAMPP 安装将始终产生错误。
  • 没错,必须有邮件服务器才能投递邮件。
  • 你确定 $header = 'test' 不是你的问题吗?

标签: php xampp


【解决方案1】:

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

sendmail_from = "from@example.com"

【讨论】:

    猜你喜欢
    • 2015-07-03
    • 1970-01-01
    • 2013-03-13
    • 2015-12-16
    • 2016-06-18
    • 2018-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多