Last active
March 4, 2021 21:12
-
-
Save mikesmullin/888642 to your computer and use it in GitHub Desktop.
install msmtp gmail, a localhost sendmail alternative
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup msmtp for sending out email | |
# as an alternative to sendmail | |
# i prefer this because it is easier to install and configure than sendmail | |
# especially when using Gmail smtp servers | |
sudo -i | |
apt-get install msmtp | |
ln -s /usr/bin/msmtp /usr/sbin/sendmail | |
touch /var/log/msmtprc && chmod 666 /var/log/msmtprc | |
vim /etc/msmtprc | |
# config options: http://msmtp.sourceforge.net/doc/msmtp.html#A-user-configuration-file | |
defaults | |
logfile /tmp/msmtp.log | |
# gmail account | |
account gmail | |
auth on | |
host smtp.gmail.com | |
port 587 | |
user your.account@gmail.com | |
password yourpassword | |
from your.account@gmail.com | |
tls on | |
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt | |
# set default account to use | |
account default : gmail | |
:wq | |
# now test msmtp | |
sendmail me@example.com # use your own email address | |
Subject: testing | |
hello | |
# Ctrl+D to send | |
# check email to ensure it arrived |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment