我按照这个教程来获取电子邮件在我的VPS上工作。 我一直有问题发送电子邮件到Gmail。
我可以收到电子邮件,但发送到Gmail的任何邮件都会popup以下消息:
我们的系统已经检测到这个消息是550-5.7.1可能是未经请求的邮件。 为了减less发送给Gmail的垃圾邮件数量,550-5.7.1该邮件已被阻止。 请访问550 5.7.1 https://support.google.com/mail/answer/188131获取更多信息。 qa9si13920205vdb.18 – gsmtp(回复DATA命令结束)
我已经更新了我的PTRlogging以匹配我的IP地址。
在mail.log中看到如下所示的消息之前:
postfix/smtp[3160]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400c:c06::1b]:25: Connection timed out
并在四处search后发现,这是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
该教程是伟大的(我自己也跟着它),但有一些重要的东西丢失,其中大部分与DNS相关。 看看这里: http : //blog.codinghorror.com/so-youd-like-to-send-some-email-through-code/
我无法强调这一点:你需要一个反向DNSlogging(PTR)。 大多数电子邮件提供商只会丢弃没有PTR的主机的消息。 首先解决这个问题,如果你没有PTR,其余的工作就没有意义了。
正确的SPFlogging本身并不需要传送,但是它会大大提高您的邮件在垃圾邮件文件夹中没有结束的机会。
因此,您需要configurationDKIM。 之后,将您的域添加到公共DNS白名单中。
你仍然会在一些垃圾邮件文件夹(如果我没有记错outlook.com似乎不正确支持DKIM),但比以前less了:)