emerge mail-mta/msmtp
Create file /etc/msmtprc
# Set default values for all following accounts.
defaults
auth on
tls on
tls_certcheck off
tls_starttls off
logfile /var/log/mail.log
# Gmail account
account gmail
host smtp.gmail.com
port 465
from [email protected]
user someuser
password mySecretPassword
# Set a default account
account default : gmail
Make it defaul (only required for Debian, Gentoo already does it)
ln -s /usr/bin/msmtp /usr/bin/sendmail
One liner
(echo "Subject: SUBJECT"; echo; echo "MESSAGE") | msmtp [email protected]
With a non default account
(echo "Subject: SUBJECT"; echo; echo "MESSAGE") | msmtp -a anotherAccount [email protected]
Multiple lines (Press Ctrl+D
to send)
sendmail [email protected]
Subject: SUBJECT
MESSAGE