mail function not working in ec2 amazon aws php

mail function not working in ec2 amazon aws php

Solution worked for me:

  1. install sendmail by command:
     sudo apt-get install sendmail
  2. 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)’

  3. start the service if it is not running by following command
    service sendmail start
  4. 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.



Leave a Reply