다음 링크에서 이메일을 참조하여 서버를 구성하려고 합니다.Postfix에서 보내는 메일을 중계하는 SMTP - Webmin 사용. 나는 사용했다맨드릴내 경우에는 smtp 서버입니다. 메인 서버를 구성하기 전에 vagrent 인스턴스도 구성했습니다. 그러나 다음을 사용하여 서버(vagrant 및 main 모두)에서 이메일을 보내려고 할 때:
sendemail -f [email protected] -t <myemail>@gmail.com -m "Message Body" -u "Message Subject"
메시지는 postfix에 대기하고 결코 목적지에 도달하지 않습니다.
/var/log/mail.log
파일은 다음을 보여줍니다:
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))
그리고 /etc/postfix/main.cf
파일:
# 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
몇 가지 제안이 필요합니다. 여기서 무슨 일이 일어나고 있나요? 저는 메일 서버 구성이 매우 새롭습니다. 어리석은 실수가 있으면 용서해주세요.
답변1
여기서 문제는 모든 아웃바운드 이메일을 서버(예: )로 릴레이하도록 서버를 구성했다는 것입니다 smtp.mandrillapp.com
. 해당 서버는 귀하의 메일 릴레이를 수락하지 않습니다.
이 회사는 모르지만, 인증된 고객의 메일만 중계하는 것 같고, 로그인이 되지 않는 것 같습니다.
아마도 main.cf 어딘가에 다음과 같은 줄이 있을 것입니다.
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
파일은 /etc/postfix/remote_passwords
다음과 같아야합니다
smtp.mandrillapp.com:587 login:password
mandrillapp의 로그인/비밀번호를 사용하세요.
또한 구성 파일에서 smtpd_sasl_auth_enable
클라이언트가 서버에 로그인할 것으로 예상되는 경우에만 관련이 있는 a(smtp 끝에 'd' 참고)가 표시되는데 그에 대한 구성이 충분하지 않습니다. 꼭 필요한지 확인해야 합니다.
답변2
Mandrill API 키를 어디에서 정의하고 있나요? smtp_sasl_password_maps
에 지시문이 누락된 것 같습니다 main.cf
. 다음을 참조하십시오:
답변3
이 경우 릴레이에 대한 사용자 이름/비밀번호 콤보를 지정하는 포트가 실제로 매우 중요하다는 것이 밝혀졌습니다. 사용하고 있던 서버 이름 끝에 :588을 추가하지 못했기 때문에 내 메일 서버가 오랫동안 중단되었습니다. 정말 PITA입니다.