Skip to content

msmtp

installation

apt install msmtp-mta
touch /etc/msmtprc
chmod 600 /etc/msmtprc
nano /etc/msmtprc
account default
host smtp.mail.me.com
port 587
tls on
tls_starttls on
auth on
from <mail@domain.tld>
user <mail@domain.tld>
password <pw>
set_from_header on
syslog LOG_MAIL

aliases /etc/aliases

Tip

to use default alias like root in every process without need to change the mail in every app

nano /etc/aliases 
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: <random@domain.tld>

update aliases

newaliases 

test

echo "<test message>" | mail -s "<test subject>" <mail>

source

  • https://wiki.archlinux.org/title/Msmtp
  • https://man.archlinux.org/man/msmtp.1#CONFIGURATION_FILES
  • https://wiki.debian.org/msmtp
  • https://marlam.de/msmtp/msmtp.html#Examples
  • https://askubuntu.com/questions/878288/msmtp-cannot-write-to-var-log-msmtp-msmtp-log https://www.baeldung.com/linux/etc-aliases-file