[英]Error with PHP mail() function
I'm having an error trying to send mail with PHP using the mail()
function. 我在使用
mail()
函数尝试使用PHP发送邮件时遇到错误。 Here's the error message I'm getting: 这是我得到的错误消息:
sendmail_from" not set in php.ini or custom "From:" header missing
in C:\xampp\htdocs\strawman\addstudent.php on line 265..
When sending a mail, a From
header (ie the address from which the mail is sent) has to be set. 发送邮件时,必须设置
From
标题(即发送邮件的地址)。
This can be set either : 这可以设置为:
sendmail_from
in your php.ini
file (on windows) php.ini
文件中设置sendmail_from
的值(在windows上) From
header to the mail
function -- in the fourth parameter. From
头传递给mail
函数 - 在第四个参数中。
The message you posted indicates you've done none of those -- and that you must do at least one, to specify a From
header. 您发布的消息表明您没有完成这些操作 - 并且您必须至少执行一次,以指定
From
标头。
Quoting the Note in the "*additional_headers*" section of the manual page of mail()
: 在
mail()
手册页的“* additional_headers *”部分中引用注释:
When sending mail, the mail must contain a
From
header.发送邮件时,邮件必须包含
From
标头。
This can be set with theadditional_headers
parameter, or a default can be set inphp.ini
.这可以使用
additional_headers
参数设置,或者可以在php.ini
设置默认值。Failing to do this will result in an error message similar to
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing.
如果不这样做将导致类似于
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing.
的错误消息Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing.
TheFrom
header sets alsoReturn-Path
under Windows.From
标头在Windows下也设置了Return-Path
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.