title: Is it possible to configure sendmail to use SMTP authentication by default (for use with PHP)?
body: <p>I am maintaining an old PHP application and I would like to configure it to use <a href="http://www.mandrill.com/" rel="nofollow">Mandrill</a> for outgoing email. Mandrill, of course, requires SMTP authentication. The application uses PHP's <code>mail()</code> function directly.</p>
  
  <p>Is there any way I can configure sendmail (or an equivalent service) to send using SMTP authentication by default (with the credentials for Mandrill), without having to replace all the <code>mail()</code> calls throughout the application?</p>
  
  <p>I saw some other answers about SMTP configuration in php.ini but that only works on Windows, so I believe the only PHP setting I could change that would potentially be useful is <code>sendmail_path</code>, which defaults to <code>sendmail -t -i</code>. I was thinking maybe I could point it to a shell script instead but I'm not sure how to go about that or whether it would work.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks to @mti2935's answer, I was able to get this working. I had trouble getting sSMTP to work (got the error "send-mail: Cannot open smtp.mandrillapp.com:587" even though there was no firewall blocking it) so I followed the second link and set up MSMTP. I had to change the <code>tls_trust_file</code> setting to /etc/pki/tls/certs/ca-bundle.crt (note: I'm running CentOS 6). Also, the <code>sendmail_path</code> PHP setting recommended in the link didn't work for me; I had to change it to "/usr/bin/msmtp -C /etc/msmtp/myconfig -t" (and restart Apache since I changed this in php.ini rather than in an .htaccess file...note that the config file can be called whatever you want; choose your own name in place of "myconfig").</p>
  
  <p>Also, when testing, be sure to specify a "From" address, otherwise some destinations including Gmail might reject the message.</p>