To check if the mail function is enabled on your server or PHP install, use
<?php
if ( function_exists( 'mail' ) )
{
echo 'mail() is available';
}
else
{
echo 'mail() has been disabled';
}
?>
to check if it sending mail
<?php
$email = "[email protected]";
$subject = "Email Test";
$message = "this is a mail testing email function on server";
$sendMail = mail($email, $subject, $message);
if($sendMail)
{
echo "Email Sent Successfully";
}
else
{
echo "Mail Failed";
}
?>
If the mail() function exist but mails not going, check if a mail transport agent (MTA)such as sendmail or postfix is installed on your server
If you on Linux :
Try;
$ dpkg -S `which sendmail`
to install sendmail on Ubuntu;
sudo apt-get install sendmail
https://www.digitalocean.com/community/questions/setting-up-email-with-sendmail
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…