对于邮件转发,我的 Postfix 配置中的 MX 记录应该是什么样子的?

对于邮件转发,我的 Postfix 配置中的 MX 记录应该是什么样子的?

我有一个 Digital Ocean VPS,我在上面安装了后缀。 我想要做邮件转发

当我安装 postfix 时我选择了无需配置选项。后来我设置了以下内容:

我创建main.cf/etc/postfix

virtual_alias_domains = gintegraconstruccion.com
virtual_alias_maps = hash:/etc/postfix/virtual

创建virtual

[电子邮件保护] [电子邮件保护]

然后我重新启动了 postfix。

在我的 DNS 配置中(我得到了去吧爸爸)我做了:

创建了一个一个记录

Host        Points to
contacto    107.XX.XX.XX

创建了一个MX 记录

Host        Points to
@           contacto.gintegraconstruccion.com

然而我尝试了一下并且在我的 Gmail 收件箱中收到了一些邮件。

的输出dig gintegraconstruccion.com为:

; <<>> DiG 9.8.1-P1 <<>> gintegraconstruccion.com mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34297
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;gintegraconstruccion.com.  IN  MX

;; ANSWER SECTION:
gintegraconstruccion.com. 599   IN  MX  0 contacto.gintegraconstruccion.com.

;; Query time: 93 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Wed May 14 13:01:53 2014
;; MSG SIZE  rcvd: 67

仅供记录,我目前使用 Openshift 托管网站,因为我还没有迁移它。

检查/etc/log/mail.log我发现:

May 14 11:52:51 localhost postfix/postfix-script[24478]: fatal: the Postfix mail system is not running
May 14 12:02:05 localhost postfix/postfix-script[24600]: fatal: the Postfix mail system is not running
May 14 12:02:27 localhost postfix/master[24724]: daemon started -- version 2.9.6, configuration /etc/postfix
May 14 12:02:31 localhost postfix/master[24724]: reload -- version 2.9.6, configuration /etc/postfix
May 14 13:06:07 localhost postfix/smtpd[24865]: error: open database /etc/aliases.db: No such file or directory
May 14 13:06:07 localhost postfix/smtpd[24865]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 14 13:06:07 localhost postfix/smtpd[24865]: connect from f.qw.se[109.74.194.71]
May 14 13:06:13 localhost postfix/smtpd[24865]: disconnect from f.qw.se[109.74.194.71]
May 14 13:06:44 localhost postfix/smtpd[24865]: connect from f.qw.se[109.74.194.71]
May 14 13:07:07 localhost postfix/smtpd[24865]: 5F052432EF: client=f.qw.se[109.74.194.71]
May 14 13:07:15 localhost postfix/smtpd[24865]: disconnect from f.qw.se[109.74.194.71]
May 14 13:10:36 localhost postfix/anvil[24867]: statistics: max connection rate 2/60s for (smtp:109.74.194.71) at May 14 13:06:44
May 14 13:10:36 localhost postfix/anvil[24867]: statistics: max connection count 1 for (smtp:109.74.194.71) at May 14 13:06:07
May 14 13:10:36 localhost postfix/anvil[24867]: statistics: max cache size 1 at May 14 13:06:07
May 14 13:14:20 localhost postfix/master[24724]: reload -- version 2.9.6, configuration /etc/postfix
May 14 13:18:29 localhost postfix/master[24724]: reload -- version 2.9.6, configuration /etc/postfix
May 14 13:21:04 localhost postfix/smtpd[24982]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 14 13:21:04 localhost postfix/smtpd[24982]: connect from mail-wi0-f175.google.com[209.85.212.175]
May 14 13:21:05 localhost postfix/smtpd[24982]: 1BC40432EF: client=mail-wi0-f175.google.com[209.85.212.175]
May 14 13:21:05 localhost postfix/cleanup[24987]: 1BC40432EF: message-id=<[email protected]$
May 14 13:21:05 localhost postfix/qmgr[24976]: 1BC40432EF: from=<[email protected]>, size=2670, nrcpt=1 (queue active)
May 14 13:21:05 localhost postfix/smtpd[24982]: disconnect from mail-wi0-f175.google.com[209.85.212.175]
May 14 13:21:05 localhost postfix/smtp[24988]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400e:c01::1a]:25: Network is unreachable
May 14 13:21:06 localhost postfix/smtp[24988]: 1BC40432EF: to=<[email protected]>, orig_to=<[email protected]$
May 14 13:21:06 localhost postfix/qmgr[24976]: 1BC40432EF: removed

日志的最后几行(从 hotmail 发送的邮件成功后):

May 14 13:52:19 localhost postfix/smtpd[25133]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 14 13:52:19 localhost postfix/smtpd[25133]: connect from col0-omc1-s18.col0.hotmail.com[65.55.34.28]
May 14 13:52:20 localhost postfix/smtpd[25133]: 22ED0432EF: client=col0-omc1-s18.col0.hotmail.com[65.55.34.28]
May 14 13:52:20 localhost postfix/cleanup[25137]: 22ED0432EF: message-id=<[email protected]>
May 14 13:52:20 localhost postfix/qmgr[25091]: 22ED0432EF: from=<[email protected]>, size=1528, nrcpt=1 (queue active)
May 14 13:52:20 localhost postfix/smtpd[25133]: disconnect from col0-omc1-s18.col0.hotmail.com[65.55.34.28]
May 14 13:52:22 localhost postfix/smtp[25138]: 22ED0432EF: to=<[email protected]>, orig_to=<[email protected]>$
May 14 13:52:22 localhost postfix/qmgr[25091]: 22ED0432EF: removed

答案1

因为您的虚拟地图是创建文件后的类型(由配置行中hash指定),您需要通过运行来创建地图。hash:virtualpostmap /etc/postfix/virtual

根据日志中的错误来判断,您还需要运行,postalias /etc/aliases因为它抱怨没有aliases.db文件。

您的配置行中有一个拼写错误virtual_alias_domains。域名的首字母是 Q,而不是 G。

virtual_alias_domains = qintegraconstruccion.com

如果您的实际配置文件中存在该问题,而这不仅仅是这里问题中的拼写错误,那么也需要修复。

最后,您提供的日志样本中似乎有一封成功转发的电子邮件。邮件1BC40432EF已成功发送给 Google。Google 很可能在接受电子邮件后将其丢弃,但他们做过接受。


一般可交付性对您来说很重要。由于您没有运行 Google Apps for Business,因此您无法在 Google 内部将您的 IP 地址列入白名单。因此您必须遵守所有常规最佳做法。如果您全部正确无误,Gmail 应该不会拒绝您的邮件。

  • 您目前没有对 IP 地址进行反向查找。您必须向 DigitalOcean 询问。它应该与myhostname您的 postfix 配置中的指令相同。我建议使用它,contacto.gintegraconstruccion.com因为它已经指向正确的 IP 地址。
  • 您目前不在 SpamHaus 的 PBL 上。这很好,但很幸运。Amazon EC2 地址除非您要求 Amazon 删除您的 IP 地址,否则您将无法在 PBL 上发送邮件。云提供商(和住宅提供商)可能会在 PBL 上,因为他们的政策是您不应从该 IP 地址发送邮件。
  • 你没有SPF 记录
  • 您不太可能拥有 DKIM 记录。
  • 您没有 DMARC 记录。这将有助于了解为什么某些提供商拒绝您的邮件。如果您错误地配置了 SPF 或 DKIM 记录,DMARC 报告会通知您。
  • From: 地址是 @gmail.com 地址。我不知道您的信封发件人地址是什么样子,但如果也是这样,那么gmail.com任何支持 SPF 的主机都会拒绝您的邮件,因为您的 IP 地址不在 Gmail 的 SPF 记录中。信封发件人地址由smtp_helo_name您的 postfix 配置中的行设置。

相关内容