Actually configure Postfix or Sendmail for PHP mail() is the same. Both of them run the /usr/sbin/sendmail binary. It is quite confusing if we just look at the name of the binary but this is what Postfix did.
For more information, take a look at the Postfix Manual – sendmail.
For the PHP setting, open the /etc/php5/apache2/php.ini and configure the sendmail_path.
; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "/usr/sbin/sendmail -t -i"
Save the file and restart the Apache server.
Try testing the PHP mail() function by the following command. Thanks amitbhatia1. =)
echo testing | mail -s Bla firstname.lastname@example.org
If you need to send with attachment. you can refer to this post.
PHP – Send Attachment with PHP mail()