My server is Red Hat Enterprise Linux Server release 7.1 . I am trying to send simple emails using localhost.
$to = 'kosala@xxxxxx.com;
$subject = 'Fake sendmail test';
$message = 'If we can read this, it means that our fake Sendmail setup works!';
$headers = 'From: myemail@egmail.com' . "\r\n" .
'Reply-To: myemail@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $message, $headers)) {
echo 'Email sent successfully!';
} else {
die('Failure: Email was not sent!');
}
response is : Email sent successfully!
But i have not received any mails.My smtp port 25 is open,i checked it using below command.
nmap -sT -O localhost
Output of echo "test" | sendmail xxxx@gmail.com
command is
You have new mail in /var/spool/mail/root
Thanks in advance, Kosala