Inhaltsverzeichnis:

smtp sendmail

2021-05-11 / 2023-11-23

Kleine Mailbibliotheke um einfach im Linux mails zu versenden

Installation

sudo apt install msmtp msmtp-mta mailutils

Default-Konfiguration

sudo nano /etc/msmtprc
# Set default values for all following accounts.
defaults

# Use the mail submission port 587 instead of the SMTP port 25.
port 587

# Always use TLS.
tls on

# Set a list of trusted CAs for TLS. The default is to use system settings, but
# you can select your own file.
#tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Mail account
account root

# Host name of the SMTP server
host smtp.strato.de

# Envelope-from address
from noreply@heister.email

# Authentication. The password is given using one of five methods, see below.
auth on

# Use your own user name fpr the mail account
user noreply@heister.email

# loginpassword (da ist ein SLASH im Passwort das ersetzt werden muss!)
password ♯crypt♯

# Set a default account
account default: root

# Map local users to mail addresses (for crontab)
#aliases /etc/aliases

Berechtigungen

sudo chown root:adm /etc/msmtprc
sudo chmod 660 /etc/msmtprc

Troubleshooting debian

sudo usermod -aG adm mani

Mail testen

echo "this is a test" | mail -s Subject test@heister.email