Configure the MSMTP mail server.

msmtp is a smtp client send mails to other smtp servers, install msmtp with:

aptitude install msmtp msmtp-gnome
msmtp configuration files /etc/msmtprc for all users and ~/.msmtprc for one user. For user create a file ~/.msmtprc with this parameters:
# Use an external SMTP server with insecure authentication.
# (manually choose an insecure authentication method.)
# Note that the password contains blanks.

defaults

######################################################################
# A sample configuration using Gmail
######################################################################

# account name is "gmail".
# You can select this account by using "-a gmail" in your command line.
account gmail
host smtp.gmail.com
tls on
tls_certcheck off
port 587
auth login
from [email protected]
user somebody
password somesecret

######################################################################
# A sample configuration using other normal ESMTP account
######################################################################

# account name is "someplace".
# You can select this account by using "-a someplace" in your command line.
account someplace
host smtp.someplace.com
from [email protected]
auth login
user someone
password somesecret

# If you don't use any "-a" parameter in your command line,
# the default account "someplace" will be used.
account default: someplace
Change the ownership of ".msmtprc" to "0600".
Find out which authentication methods your server supports with this command:
msmtp --serverinfo --account=default
Test functionality
The account option (--account=,-a tells which account to use as sender:
echo "hello there username." | msmtp -a default [email protected]
Or, with the addresses in a file test.mail: To: [email protected] From: [email protected] Subject: A test Hello there.
Then send with command:
cat test.mail | msmtp -a default @domain.com
To send mail from command line first run this command in the terminal:
cat <<EOF | msmtp -a gmail [email protected]
After enter wirte the subject:
Subject: test
then hit the Enter and write the message:
This is a test!
Then hit the Enter and end the mail with typing:
EOF
The message is sent, download the mstmprc.


<< Previous Next >>