Hallo zusammen,
auf meinem VPS habe ich MSMTP installiert, um damit ggf. Error-Meldungen, etc. an den Email-Account meines Webhosting-Tarifs zu senden.
Hat das schonmal jemand gemacht? Funktioniert so etwas grundsätzlich?
Die Konfiguration sieht so aus (leicht abgewandelt):
Code
cat /etc/msmtprc
# Set default values for all following accounts.
defaults
logfile /mnt/vg1/logs/msmtp/general.log
account root
# 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
# If you select your own file, you should also use the tls_crl_file command to
# check for revoked certificates, but unfortunately getting revocation lists and
# keeping them up to date is not straightforward.
#tls_crl_file ~/.tls-crls
# Mail account
# account admin@meine-webhosting-domain.de
# Host name of the SMTP server
host mx9eb9.netcup.net
# As an alternative to tls_trust_file/tls_crl_file, you can use tls_fingerprint
# to pin a single certificate. You have to update the fingerprint when the
# server certificate changes, but an attacker cannot trick you into accepting
# a fraudulent certificate. Get the fingerprint with
# $ msmtp --serverinfo --tls --tls-certcheck=off --host=smtp.freemail.example
#tls_fingerprint 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
# Envelope-from address
from root@mein-vps-hostname
# Authentication. The password is given using one of five methods, see below.
auth on
user admin@meine-webhosting-domain.de
# Password method 1: Add the password to the system keyring, and let msmtp get
# it automatically. To set the keyring password using Gnome's libsecret:
# $ secret-tool store --label=msmtp \
# host smtp.freemail.example \
# service smtp \
# user joe.smith
# Password method 2: Store the password in an encrypted file, and tell msmtp
# which command to use to decrypt it. This is usually used with GnuPG, as in
# this example. Usually gpg-agent will ask once for the decryption password.
#passwordeval gpg2 --no-tty -q -d ~/.msmtp-password.gpg
# Password method 3: Store the password directly in this file. Usually it is not
# a good idea to store passwords in plain text files. If you do it anyway, at
# least make sure that this file can only be read by yourself.
password xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Password method 4: Store the password in ~/.netrc. This method is probably not
# relevant anymore.
# Password method 5: Do not specify a password. Msmtp will then prompt you for
# it. This means you need to be able to type into a terminal when msmtp runs.
logfile /mnt/vg1/logs/msmtp/root.log
# Set a default account
account default: root
# Map local users to mail addresses (for crontab)
aliases /etc/aliases
Alles anzeigen
Den Emailversand teste ich mit
Code
echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" | msmtp --debug --from=default -t admin@meine-webhosting-domain.de
Und bekomme dabei folgende Meldung
Code
echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" | msmtp --debug --from=default -t admin@meine-webhosting-domain.de
systemweite Konfigurationsdatei /etc/msmtprc geladen
Benutzerkonfigurationsdatei /root/.msmtprc wird ignoriert: No such file or directory
Standardkonto wird benutzt
Konto default aus /etc/msmtprc wird benutzt
host = mx9eb9.netcup.net
port = 587
source ip = (nicht festgelegt)
proxy host = (nicht festgelegt)
proxy port = 0
timeout = aus
protocol = smtp
domain = localhost
auth = wählen
user = admin@meine-webhosting-domain.de
password = *
passwordeval = (nicht festgelegt)
ntlmdomain = (nicht festgelegt)
tls = an
tls_starttls = an
tls_trust_file = /etc/ssl/certs/ca-certificates.crt
tls_crl_file = (nicht festgelegt)
tls_fingerprint = (nicht festgelegt)
tls_key_file = (nicht festgelegt)
tls_cert_file = (nicht festgelegt)
tls_certcheck = an
tls_min_dh_prime_bits = (nicht festgelegt)
tls_priorities = (nicht festgelegt)
auto_from = aus
maildomain = (nicht festgelegt)
from = default
add_missing_from_header = an
add_missing_date_header = an
remove_bcc_headers = an
dsn_notify = (nicht festgelegt)
dsn_return = (nicht festgelegt)
logfile = /mnt/vg1/logs/msmtp/root.log
logfile_time_format = (nicht festgelegt)
syslog = (nicht festgelegt)
aliases = /etc/aliases
Empfängerliste aus Befehlszeile und Mail lesen
<-- 220 mx9eb9.netcup.net ESMTP Postfix (Debian/GNU)
--> EHLO localhost
<-- 250-mx9eb9.netcup.net
<-- 250-PIPELINING
<-- 250-SIZE 52428800
<-- 250-ETRN
<-- 250-STARTTLS
<-- 250-ENHANCEDSTATUSCODES
<-- 250-8BITMIME
<-- 250-DSN
<-- 250-SMTPUTF8
<-- 250 CHUNKING
--> STARTTLS
<-- 220 2.0.0 Ready to start TLS
TLS-Sitzungsparameter:
(TLS1.2)-(ECDHE-X25519)-(RSA-PSS-RSAE-SHA256)-(AES-128-GCM)
TLS-Zertifikatinformation:
Eigentümer:
Allgemeiner Name: *.netcup.net
Aussteller:
Allgemeiner Name: RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1
Organisation: DigiCert Inc
Land: US
Gültigkeit:
Aktivierungszeitpunkt: Mi 04 Nov 2020 01:00:00 CET
Ablaufzeitpunkt: Fr 05 Nov 2021 00:59:59 CET
Fingerabdrücke:
SHA256: BA:25:94:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:EF:41:13
SHA1 (deprecated): 70:95:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:04:C5:58
--> EHLO localhost
<-- 250-mx9eb9.netcup.net
<-- 250-PIPELINING
<-- 250-SIZE 52428800
<-- 250-ETRN
<-- 250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
<-- 250-ENHANCEDSTATUSCODES
<-- 250-8BITMIME
<-- 250-DSN
<-- 250-SMTPUTF8
<-- 250 CHUNKING
--> AUTH PLAIN AGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxYTc=
<-- 235 2.7.0 Authentication successful
--> MAIL FROM:<default>
--> RCPT TO:<admin@meine-webhosting-domain.de>
--> DATA
<-- 250 2.1.0 Ok
<-- 250 2.1.5 Ok
<-- 354 End data with <CR><LF>.<CR><LF>
--> From: default
--> Date: Sun, 04 Apr 2021 12:19:32 +0200
--> Subject: Test Mail
-->
--> This is a test mail
--> .
<-- 451 4.3.0 pymilter: untrapped exception in pythonfilter
msmtp: der Server hat die Mail nicht akzeptiert
msmtp: Nachricht des Servers: 451 4.3.0 pymilter: untrapped exception in pythonfilter
msmtp: Mail konnte nicht verschickt werden (Konto default aus /etc/msmtprc)
msmtp: Protokollinformation kann nicht in /mnt/vg1/logs/msmtp/root.log geschrieben werden: kann nicht geöffnet werden: Permission denied
msmtp: Protokollinformation war: host=mx9eb9.netcup.net tls=on auth=on user=admin@meine-webhosting-domain.de from=default recipients=admin@meine-webhosting-domain.de smtpstatus=451 smtpmsg='451 4.3.0 pymilter: untrapped exception in pythonfilter' errormsg='der Server hat die Mail nicht akzeptiert' exitcode=EX_UNAVAILABLE
Alles anzeigen
Einerseits wird zwar "Authentication successful" gemeldet, andererseits kommt dann die Meldung "der Server hat die Mail nicht akzeptiert".
Außerdem irritiert mich, dass die Protokoll-Datei nicht geschrieben werden kann ("Permission denied"), obwohl ich als root angemeldet bin.
Ich weiß jetzt leider nicht, wie ich hier vorgehen muss. Habt ihr einen Tipp für mich?