Configuring MSMTP with gmail as a mail transfer agent
Â
This is an easy-to-setup alternative to postfix
or sendmail
configuration. The instructions have been written for Debian but should be easy to adjust for other Linux distributions.
Instructions
Log in as root and issue the following command:
apt install msmtp-mta bsd-mailx
Create the file
.msmtprc
inside home of asterisk usercat <<HERE > ~asterisk/.msmtprc
account default
host smtp.gmail.com
port 587
protocol smtp
auth on
from YOUR_GMAIL_ACCOUNT@gmail.com
user YOUR_GMAIL_ACCOUNT@gmail.com
password YOUR_PASSWORD
tls on
tls_starttls on
tls_certcheck off
HERE
Set correct permissions
chown asterisk:asterisk ~asterisk/.msmtprc
chmod 600 ~asterisk/.msmtprc
Send a test email from CLI (under
asterisk
user)echo "test email" | mail -s test_email OTHER_EMAIL@SOME_PROVIDER.com
Test sending email from FreePBX