使用 XAMPP 发送邮件时出错 [英] Error on sending mail with XAMPP

查看:34
本文介绍了使用 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

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

请帮忙!

推荐答案

确保在 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 = "from@example.com"

这篇关于使用 XAMPP 发送邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆