Skip to content

msmtp

Install

apt install msmtp msmtp-mta

Config

vim /etc/msmtprc 
# -------
defaults
tls on
auth on
logfile /var/log/msmtp
tls_trust_file /etc/ssl/certs/ca-certificates.crt
# -------
account noreply
host mail.domain.com
from noreply@domain.com
port 25
tls on
tls_starttls on
tls_certcheck off
user noreply@domain.com
password [PASSWORD]
# -------
account default : noreply

Test

echo "msmtp test message" | /usr/bin/msmtp user@domain.com
# with debug
echo "msmtp test message" | /usr/bin/msmtp --debug user@domain.com

Log

tail -f /var/log/msmtp

Nov 01 03:21:28 host=mail.domain.com tls=on auth=on user=noreply@domain.com from=noreply@domain.com recipients=user@domain.com mailsize=76 smtpstatus=250 smtpmsg='250 OK id=1kZ23k-0002ZV-Qd' exitcode=EX_OK