Ich versuche, meinen Server für E-Mail zu konfigurieren und greife dabei auf diesen Link zurück:SMTP-Relaying ausgehender E-Mails in Postfix – mithilfe von Webmin. Ich benutzteMandrillSMTP-Server in meinem Fall. Ich habe auch eine Vagrant-Instanz konfiguriert, bevor ich den Hauptserver konfiguriert habe. Aber wenn ich versuche, E-Mails vom Server (sowohl Vagrant als auch Hauptserver) zu senden, verwenden Sie:
sendemail -f [email protected] -t <myemail>@gmail.com -m "Message Body" -u "Message Subject"
Die Nachrichten werden in Postfix in die Warteschlange gestellt und erreichen nie das Ziel.
/var/log/mail.log
Die Datei zeigt:
precise64 postfix/smtpd[16542]: connect from localhost[127.0.0.1]
precise64 postfix/smtpd[16542]: 116033A4253: client=localhost[127.0.0.1]
precise64 postfix/cleanup[16545]: 116033A4253: message-id=<621108.689435886-sendEmail@precise64>
precise64 postfix/qmgr[12672]: 116033A4253: from=<[email protected]>, size=916, nrcpt=1 (queue active)
precise64 postfix/smtpd[16542]: disconnect from localhost[127.0.0.1]
precise64 postfix/smtp[16546]: Untrusted TLS connection established to smtp.mandrillapp.com[54.195.231.78]:587: TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)
precise64 postfix/smtp[16546]: 116033A4253: host smtp.mandrillapp.com[54.195.231.78] said: 454 4.7.1 <[email protected]>: Relay access denied (in reply to RCPT TO command)
precise64 postfix/smtp[16546]: Untrusted TLS connection established to smtp.mandrillapp.com[54.247.27.189]:587: TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)
precise64 postfix/smtp[16546]: 116033A4253: to=<[email protected]>, relay=smtp.mandrillapp.com[54.247.27.189]:587, delay=4.3, delays=0.06/0.01/4/0.28, dsn=4.7.1, status=deferred (host smtp.mandrillapp.com[54.247.27.189] said: 454 4.7.1 <[email protected]>: Relay access denied (in reply to RCPT TO command))
Und die /etc/postfix/main.cf
Datei:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = precise64
# myhostname = example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = precise64, localhost.localdomain, , localhost
relayhost = smtp.mandrillapp.com:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
# mynetworks = example.com
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks reject_unauth_destination
virtual_alias_maps = hash:/etc/postfix/generic
smtp_tls_loglevel = 1
smtp_tls_security_level = encrypt
smtp_sasl_security_options = noanonymous
smtp_generic_maps = hash:/etc/postfix/generic
Brauche einen Vorschlag. Was läuft hier falsch? Ich bin noch sehr neu in der Mailserver-Konfiguration. Bitte entschuldigen Sie, wenn dumme Fehler passieren.
Antwort1
Das Problem besteht darin, dass Sie Ihren Server so konfiguriert haben, dass er alle ausgehenden E-Mails an einen Server weiterleitet, nämlich smtp.mandrillapp.com
. Dieser Server wiederum lehnt die Weiterleitung Ihrer E-Mails ab.
Ich kenne diese Firma nicht, aber ich vermute, dass sie nur E-Mails von authentifizierten Kunden weiterleiten und dass Sie sich nicht anmelden.
Wahrscheinlich sollte irgendwo in Ihrer main.cf-Datei eine Zeile wie die folgende stehen.
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/remote_passwords
smtp_sasl_security_options = noplaintext,noanonymous
smtp_sasl_tls_security_options = noanonymous
Die Datei /etc/postfix/remote_passwords
sollte so aussehen
smtp.mandrillapp.com:587 login:password
mit Ihrem Login/Passwort von Mandrillapp.
Außerdem sehe ich in Ihrer Konfigurationsdatei ein smtpd_sasl_auth_enable
(beachten Sie das „d“ am Ende von SMTP), das nur relevant ist, wenn Sie erwarten, dass sich der Client bei Ihrem Server anmeldet, und ich sehe dafür nicht genügend Konfiguration. Sie sollten sicherstellen, dass es notwendig ist.
Antwort2
Wo definieren Sie den Mandrill-API-Schlüssel? Ich glaube, Ihnen fehlt smtp_sasl_password_maps
die Direktive in main.cf
. Bitte beachten Sie Folgendes:
Antwort3
Es stellte sich heraus, dass der Port in diesem Fall, in dem Sie die Kombination aus Benutzername und Passwort für Ihr Relay angeben, tatsächlich super wichtig ist. Mein Mailserver war ewig hängengeblieben, weil ich vergessen hatte, :588 an das Ende des von mir verwendeten Servernamens anzuhängen. So ein Ärgernis.