Answer the question
In order to leave comments, you need to log in
Why is the PHP mail() function not working on the server?
The simplest script.
// Send email
if (mail($mail_to, $subject, "", $header)) {
echo "Sent";
} else {
echo "Error";
}
Answer the question
In order to leave comments, you need to log in
Check if the mail function works at all on the server:
Check if the mail service is installed: sendmail, postfix or another.
Check if the mail service is running.
For sendmail/postfix, check the settings in php.ini:
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "/usr/sbin/sendmail -t -i"
disable_functions
is there a local SMTP server?
if in *NIX you can check from the console
echo “Test Mail” | mail -s “Hello world” [email protected]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question