Differences between revisions 6 and 7
Revision 6 as of 2018-07-23 06:23:28
Size: 1648
Editor: ?Buo-renLin
Comment: Add proper trial example
Revision 7 as of 2018-08-03 11:47:40
Size: 1649
Editor: PauloSantana
Comment:
Deletions are marked like this. Additions are marked like this.
Line 51: Line 51:
mail -s "teste" phls00@gmail.com < /dev/null mail -s "teste" addrees@email.com < /dev/null


msmtp - light SMTP client with support for server profiles

msmtp is an SMTP client that can be used to send mails from Mutt and probably other MUAs (mail user agents). It forwards mails to an SMTP server (for example at a free mail provider), which takes care of the final delivery. Using profiles, it can be easily configured to use different SMTP servers with different configurations, which makes it ideal for mobile clients.

config example

setting file is located in ~/.msmtprc to send email via gmail account:

# Set default values for all following accounts.
defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account gmail
host smtp.gmail.com
from <user>@gmail.com
auth on
user <user>
passwordeval gpg --no-tty -q -d ~/.msmtp-gmail.gpg

# Set a default account
account default : gmail

then create a GPG encrypted password file, by command:

gpg --encrypt -o .msmtp-gmail.gpg -r <user>@gmail.com -

The ending dash is not a typo, rather it causes gpg to use stdin. After running that snippet of code, type in your password, press enter, and press Control-d so gpg can encrypt your password.

To test it run

msmtp _recipient_address_

type-in your message, then press Ctrl-D(EOF) to send it. Then you should find your sent e-mail in the _recipient_address_'s inbox shortly afterwards. gpg-agent will be prompted out to ask for GPG passphrase when sending email.

Comments by phls:

To test it using mail command, I had to install bsd-mailx package.

mail -s "teste" addrees@email.com < /dev/null