I am using XAMPP with Mercury and Thunderbird. When I send a message through Mercury, the message works fine and I receive the email on Thunderbird. When I try in a PHP script, it does not.
I am certain it has something to do with php but I haven't been able to find a solution as to why it is not sending.
I'm not getting any errors either and it's saying the message was sent.
mailtest.php:
$to = "patrick@localhost";
$subject = "hi";
$body="text".PHP_EOL;
$body.="this message was sent".PHP_EOL;
$headers = "From: postmaster@localhost";
if (mail($to, $subject, $body, $headers)) {
echo "message sent!";
}
else {
echo "failed";
}
?>
php.ini:
[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = localhost
smtp_port = 25
; I am on Windows 7 64bit
; For Win32 only.
; http://php.net/sendmail-from
; sendmail_from = localhost
sendmail.ini
smtp_server=localhost
smtp_port=25