I had the same issue with ec2 for php mail.
install Sendmail by command:
sudo apt-get install sendmail
check the service whether it’s started or not by executing following command
sudo service sendmail status
Note: Output of the above command should be something – ‘Active: active (running)’
start the service if it is not running by the following command
sudo service sendmail start
After the service is started, send a test mail using the following command:
echo "This is test mail body" | mail -s "Test Mail Subject" "[email protected]"
Replace email with your email ID and see if you receive this email if yes, then your mail setup is fine and now your PHP email should be working fine.
If not, file to check for errors is /var/spool/mail/.