apt-get install msmtp ca-certificates vim /etc/msmtprc # Set defaults. defaults # Enable or disable TLS/SSL encryption. tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt # Set up a default account's settings. account default host smtp.sendgrid.net port 587 auth on user password from bounces@your-doman-here logfile /var/log/msmtp/msmtp.log vim /etc/php5/apache2/php.ini sendmail_path = /usr/bin/msmtp -t mkdir /var/log/msmtp chown www-data:adm /var/log/msmtp vim /etc/logrotate.d/msmtp /var/log/msmtp/*.log { rotate 12 monthly compress missingok notifempty }