# Set default values for all following accounts.
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
# Gmail
account gmail
host smtp.gmail.com
port 587
from username@gmail.com
user username
password plain-text-password
# A freemail service
account freemail
host smtp.freemail.example
from joe_smith@freemail.example
...
# Set a default account
account default : gmail
$ echo "hello there username." | msmtp -a default username@domain.com
To: username@domain.com
From: username@gmail.com
Subject: A test
Hello there.
$ cat test.mail | msmtp -a default <username>@domain.com
I have not been able to get it to work without the -a default set, even though the config file includes the default mail account.
The previous version has the password written openly in the config file. We can encrypt the password using gpg