Debian Mail Setup
msmtp
is an SMTP client.
In its default mode of operation, it reads a mail from standard input and sends it to a predefined SMTP server that takes care of proper delivery. Command line options and exit codes are compatible to sendmail.
Install
-
Install
msmtp
: -
Create the config file
msmtprc
in/etc
(you might also need one for each user who wants to send email in~/.msmtprc
)Set chmod for those files to
0600
, otherwise msmtp will complain (sendmail:/home/<user>/.msmtprc
: contains secrets and therefore must have no more than user read/write permissions) -
For cron to know where to send email to you need to do one of the following:
- specify default email in
/etc/aliases
- specify [email protected] in the crontab
- specify default email in
-
Install msmtp-mta
The msmtp configuration then looks as follows:
# find out more about the configuration here: https://marlam.de/msmtp/msmtprc.txt
# Set default values for all following accounts.
defaults
auth on
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /var/log/msmtp
aliases /etc/aliases
set_from_header on
# server
account apple
host smtp.mail.me
port 587
from "Sanctuary <[email protected]>"
user [email protected]
password aqtd-rock-xrri-zbas
# Set a default account
account default : apple
Failed Approaches
- sendmail - too damn complicated
- nullmailer - looked good but ran into issue with empty
<from>
header upsetting icloud
References