Sendmail for PHP in Bitnami with Amazon AWS

This is quite tricky but that’s how I go about it:

    • Install sendmail:
      sudo apt-get install sendmail
    • Uncomment the following line in your /opt/bitnami/php/etc/php.iniĀ file to enable sendmail via php:
      sendmail_path = “env -i /usr/sbin/sendmail -t -i”
    • Restart Apache:
      sudo /opt/bitnami/ restart apache
    • Restart php-fpm:
      /opt/bitnami/ restart php-fpm
    • To enable sendmail to use STARTTLS, you need to add this line to /etc/mail/ and optionally to /etc/mail/
    • Add DH parametes:
      openssl dhparam -out /etc/mail/tls/sendmail-common.prm -2 1024
    • Run with sudo user:
      sudo sendmailconfig
    • Reload mail:
      service sendmail reload

    Now send a mail with PHP and see if there is any error in /var/log/mail.log
    The email is sent successfully if you see Stat=sent there.

    Additionally, you can sent a test email directly from the command line:
    echo "Subject: sendmail test" | sendmail -v

    If you don’t have MX record in your DNS then you may create one for your domain name as well.