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..
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 :
sendmail_from in your php.ini file (on windows)From header to the mail function -- in the fourth parameter.Quoting the Note in the "additional_headers" section of the manual page of mail() :
When sending mail, the mail must contain a
Fromheader.
This can be set with theadditional_headersparameter, or a default can be set inphp.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.
TheFromheader sets alsoReturn-Pathunder Windows.
php.ini file to set the sendmail_from directive ;; or pass a From header to the mail() function (see the examples in the manual -- Example #2 has a From header)