I have the following PHP script to test mail() functionality:
<?php
echo `whoami`;
error_reporting(E_ALL);
ini_set('display_errors', '1');
$name = 'John';
$email = 'j@example.com';
$message = 'My message';
$verify = '4';
$to = 'youremailaddress@somedomain.com';
$subject = 'Enquiry';
$headers = 'From: j@example.com' . "\r\n" .
'Reply-To: j@example.com' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (1 == 1)
{
if (mail($to, $subject, $message, $headers))
{
echo '<p>Sucess</p>';
}
else
{
echo '<p>Something went wrong</p>';
}
}
else
{
echo '<p>Submit not clicked</p>';
}
?>
Upon accessing the page I receive no errors, the output in the log file is as follows:
[20-Jan-2017 00:07:25 America/New_York] mail() on [/var/www/html/contact/contact.php:20]: To: youremailaddress@somedomain.com -- Headers: From: j@example.com Reply-To: j@example.com MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 X-Mailer: PHP/5.6.29-0+deb8u1
The script appears to execute correctly but I do not receive any email.