How to replace Sendmail with Gmail smtp on Ubuntu server

Today my goal was to be able to send mails from PHP from my web-server using Gmail smtp.

  1. My server runs on Apache with vhosts: I need a separate mailbox for every domain.
  2. I don’ want to manage a MTA because it’s resource and time expensive, so I want to send mails trough a Gmail account.
  3. I want the system to be fast and easy to maintain.

The standard packages such as postfix, sendmail, qmail etc doesn’t meet the last two requirements, so I had to choose an alternative to postfix: MSMTP

Continue reading →