开发者

Error with PHP mail() function

I'm having an error trying to send mail with PHP using the mail() function.开发者_如何学编程 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 (i.e. the address from which the mail is sent) has to be set.

This can be set either :

  • setting a value for sendmail_from in your php.ini file (on windows)
  • or passing a From header to the mail function -- in the fourth parameter.


The message you posted indicates you've done none of those -- and that you must do at least one, to specify a From header.

Quoting the Note in the "*additional_headers*" section of the manual page of mail() :

When sending mail, the mail must contain a From header.
This can be set with the additional_headers parameter, or a default can be set in 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.
The From header sets also Return-Path under Windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜