Skip to content

Instantly share code, notes, and snippets.

@terwey terwey/readme.md
Last active Jul 24, 2017

Embed
What would you like to do?
PHP mail with SMTP for Apache/nginx/etc

Setup

apt-get install msmtp

vim /etc/msmtprc

defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt 
account YourSMTP
host smtp.foobar.com
from baz@foobar.com
auth on
user baz
password bazS3cr3tpass

account default: YourSMTP

chmod 0600 /etc/msmtprc

chown www-data:www-data /etc/msmtprc

vim /etc/php/7.0/apache2/php.ini

Change the sendmail_path to: sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc -t -i"

Restart Apache and you're good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.