本文介绍了使用 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 = [email protected]
and I changed the sendmail in the php.ini to: sendmail_from = [email protected]
$to='[email protected]';//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 中配置了 stmp 服务器并正在运行.
尝试将 sendmail_from 值括在引号中
Make sure you have stmp server configured in your xampp and running.
Try enclosing the sendmail_from value in quotes
sendmail_from = "[email protected]"
这篇关于使用 XAMPP 发送邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!