web-dev-qa-db-ja.com

Gmailがpostfixメールをバウンスする

このチュートリアル に従って、VPSでメールを機能させました。 Gmailへのメール送信で問題が発生しました。

メールは正常に受信できますが、Gmailに送信されたメールはすべて次のメッセージで返送されます。

私たちのシステムは、このメッセージが550-5.7.1の迷惑メールである可能性があることを検出しました。 Gmailに送信されるスパムの量を減らすために、550-5.7.1このメッセージはブロックされています。詳細については、550 5.7.1 https://support.google.com/mail/answer/188131 にアクセスしてください。 qa9si13920205vdb.18-gsmtp(DATAコマンドの終了への応答)

IPアドレスと一致するようにPTRレコードを更新しました。

Mail.logに次のようなメッセージが表示される前:

postfix/smtp[3160]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400c:c06::1b]:25: Connection timed out

周りを検索したところ、これがIPv6の問題であることがわかりました。これは、ボックスで無効にしています。これらのメッセージの受信を停止しましたが、バウンスメッセージを受信して​​います。

これが私の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 (Debian/GNU)
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

smtpd_tls_cert_file=/etc/ssl/private/<redacted>_com/ssl-bundle.crt
smtpd_tls_key_file=/etc/ssl/private/<redacted>_com.key
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_loglevel = 1

smtp_address_preference = ipv4

#Enabling SMTP for authenticated users, and handing off authentication to Dovecot
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

smtpd_recipient_restrictions =
      permit_sasl_authenticated,
      permit_mynetworks,
      reject_unauth_destination

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = <redacted>
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = <redacted>.com, <redacted>, localhost.<redacted>, localhost
mydestination = localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
virtual_transport = lmtp:unix:private/dovecot-lmtp

#Virtual domains, users, and aliases
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf

Gmailにメールを送信しようとしたときに取得するログは次のとおりです。

Jun  5 11:27:52 <redacted> postfix/master[5118]: terminating on signal 15
Jun  5 11:27:53 <redacted> postfix/master[5326]: daemon started -- version 2.11.3, configuration /etc/postfix
Jun  5 11:28:09 <redacted> dovecot: imap-login: Login: user=<<redacted>@<redacted>.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.1.1, mpid=5346, TLS, session=<0w+B8MYXwQB/AAAB>
Jun  5 11:28:09 <redacted> postfix/submission/smtpd[5347]: connect from localhost[127.0.0.1]
Jun  5 11:28:09 <redacted> postfix/submission/smtpd[5347]: Anonymous TLS connection established from localhost[127.0.0.1]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Jun  5 11:28:09 <redacted> postfix/submission/smtpd[5347]: 9A97B6241F: client=localhost[127.0.0.1], sasl_method=LOGIN, sasl_username=<redacted>@<redacted>.com
Jun  5 11:28:09 <redacted> postfix/cleanup[5352]: 9A97B6241F: message-id=<b0845816f2924994c29eecdeaf3c66c3@<redacted>.com>
Jun  5 11:28:09 <redacted> postfix/qmgr[5335]: 9A97B6241F: from=<<redacted>@<redacted>.com>, size=1032, nrcpt=1 (queue active)
Jun  5 11:28:09 <redacted> postfix/submission/smtpd[5347]: disconnect from localhost[127.0.0.1]
Jun  5 11:28:09 <redacted> dovecot: imap(<redacted>@<redacted>.com): Disconnected: Logged out in=912 out=460
Jun  5 11:28:09 <redacted> dovecot: imap-login: Login: user=<<redacted>@<redacted>.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.1.1, mpid=5357, TLS, session=<yW2G8MYXxgB/AAAB>
Jun  5 11:28:09 <redacted> dovecot: imap(<redacted>@<redacted>.com): Disconnected: Logged out in=333 out=1227
Jun  5 11:28:09 <redacted> dovecot: imap-login: Login: user=<<redacted>@<redacted>.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.1.1, mpid=5358, TLS, session=<xPqG8MYXxwB/AAAB>
Jun  5 11:28:09 <redacted> dovecot: imap(<redacted>@<redacted>.com): Disconnected: Logged out in=90 out=861
Jun  5 11:28:10 <redacted> postfix/smtp[5354]: 9A97B6241F: to=<<redacted>@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.141.26]:25, delay=0.95, delays=0.06/0.03/0.22/0.65, dsn=5.7.1, status=bounced (Host gmail-smtp-in.l.google.com[74.125.141.26] said: 550-5.7.1 [<redacted>      12] Our system has detected that this message is 550-5.7.1 likely unsolicited mail. To reduce the amount of spam sent to Gmail, 550-5.7.1 this message has been blocked. Please visit 550 5.7.1 https://support.google.com/mail/answer/188131 for more information. qa9si13920205vdb.18 - gsmtp (in reply to end of DATA command))
Jun  5 11:28:10 <redacted> postfix/cleanup[5352]: 9003A62422: message-id=<20150605152810.9003A62422@<redacted>>
Jun  5 11:28:10 <redacted> postfix/qmgr[5335]: 9003A62422: from=<>, size=3474, nrcpt=1 (queue active)
Jun  5 11:28:10 <redacted> postfix/bounce[5359]: 9A97B6241F: sender non-delivery notification: 9003A62422
Jun  5 11:28:10 <redacted> postfix/qmgr[5335]: 9A97B6241F: removed
Jun  5 11:28:10 <redacted> dovecot: lmtp(5362): Connect from local
Jun  5 11:28:10 <redacted> dovecot: lmtp(5362, <redacted>@<redacted>.com): nFazJArAcVXyFAAALAfe6g: msgid=<20150605152810.9003A62422@<redacted>>: saved mail to INBOX
Jun  5 11:28:10 <redacted> postfix/lmtp[5361]: 9003A62422: to=<<redacted>@<redacted>.com>, relay=<redacted>[private/dovecot-lmtp], delay=0.06, delays=0/0.02/0.01/0.03, dsn=2.0.0, status=sent (250 2.0.0 <<redacted>@<redacted>.com> nFazJArAcVXyFAAALAfe6g Saved)
Jun  5 11:28:10 <redacted> dovecot: lmtp(5362): Disconnect from local: Successful quit
Jun  5 11:28:10 <redacted> postfix/qmgr[5335]: 9003A62422: removed
3
k9rosie

チュートリアルは素晴らしいですが(私は自分でそれに従いました)、いくつかの重要な点が欠けています。それらのほとんどはDNS関連です。ここを見てください: http://blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/

これを十分に強調することはできません。逆引きDNSレコード(PTR)が必要です。ほとんどの電子メールプロバイダーは、PTRを持たないホストからのメッセージをドロップするだけです。最初にこれを修正するだけです。PTRがない場合は、残りの部分に取り組む意味はありません。

正しいSPFレコード自体は配信に必要ありませんが、メッセージがスパムフォルダに入らない可能性が大幅に向上します。

したがって、DKIMを構成する必要があります。その後、パブリックDNSホワイトリストにドメインを追加します。

あなたはまだいくつかのスパムフォルダに行き着くでしょう(私が正しく覚えていれば、Outlook.comはDKIMを正しくサポートしていないようです)が、以前よりも少ない頻度です:)

1
dtsomp