I have install mail sent in php script but mail are not received any mail.
sudo apt-get install sendmail
Also restart & reboot the EC2 server .
This code is working in another server don not working in Amzon ec2 how it works in Amazon ec2
<?php
/*
* Enable error reporting
*/
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
/*
* Setup email addresses and change it to your own
*/
$from = "dhokaijaydeep@yahoo.com";
$to = "dhokaijaydeep@gmail.com";
$subject = "Simple test for mail function";
$message = "This is a test to check if php mail function sends out the email";
$headers = "From:" . $from;
// $headers = 'From:'.$from.'<' . $from . '>' . "\r\n"; message:
// $message = "This is a test to check if php mail function sends out the email. \n\r";
/*
* Test php mail function to see if it returns "true" or "false"
* Remember that if mail returns true does not guarantee
* that you will also receive the email
*/
if(mail($to,$subject,$message, $headers))
{
echo "Test email send.";
}
else
{
echo "Failed to send.";
}
?>