Error on sending mail with XAMPP

不羁的心 提交于 2020-01-25 07:03:54

问题


Hi I keep getting the error,

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

and I changed the sendmail in the php.ini to: 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);

Please help!


回答1:


Make sure you have stmp server configured in your xampp and running.
Try enclosing the sendmail_from value in quotes

sendmail_from = "from@example.com"



来源:https://stackoverflow.com/questions/1598705/error-on-sending-mail-with-xampp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!