mail function not working in ec2 amazon aws php
Solution worked for me:
- install sendmail by command:
sudo apt-get install sendmail
- check the service whether its started or not by execuring follwing command
service sendmail status
Note: Output of above command should be something – ‘Active: active (running)’ - start the service if it is not running by following command
service sendmail start
- After the service is started, send a test mail using following command:
echo "This is test mail body" | mail -s "Test Mail Subject" "recipient@email.com"
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.