Make mail logs directory

$ sudo mkdir /var/log/mail

Create sendmail command

$ sudo nano /usr/local/bin/sendmail
#!/usr/bin/php
<?php
$input = file_get_contents( 'php://stdin' );
$filename = '/var/log/mail/eml-' . date( 'Ymd_His' ) . '.eml.log';
file_put_contents( $filename, $input );

Edit php.ini

sendmail_path = /usr/local/bin/sendmail
$ sudo chmod 755 /usr/local/bin/sendmail
$ sudo chmod 777 /var/log/mail

Restart Apache httpd service

$ sudo /etc/init.d/apache2 restart