0

I am trying to send a mail from my php server but I can't. I receive ok from mail function but nothing in my mail.

I read this post about same topic: cannot send mail using php mail function

And I checked ports, I have one in 127.0.0.1 port 25.

This is my php test file:

$msg="";
if(isset($_POST['submit']))
{

$from_add = "mymail@gmail.com";

$to_add = "mymail@gmail.com";

$subject = "Test Subject";
$message = "Test Message";

$headers = "From: $from_add \r\n";
$headers .= "Reply-To: $from_add \r\n";
$headers .= "Return-Path: $from_add\r\n";
$headers .= "X-Mailer: PHP \r\n";


if(mail($to_add,$subject,$message,$headers))
{
    $msg = "Mail sent OK";
}
else
{
   $msg = "Error sending email!";
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Test form to email</title>
</head>

<body>
<?php echo $msg ?>
<p>
<form action='<?php echo htmlentities($_SERVER['PHP_SELF']); ?>' method='post'>
<input type='submit' name='submit' value='Submit'>
</form>
</p>


</body>
</html>

Should I modify any line in my php.ini? This script shows my "Mail sent OK" after pressing the button but nothing is received.

I know this question has been asked before but I have checked many answers and they doesn't fit in my case. Thats why I am asking again.

Community
  • 1
  • 1
Biribu
  • 3,615
  • 13
  • 43
  • 79

0 Answers0