在ubuntu 14.04下的postfixconfiguration

我的专用服务器运行Ubuntu 14.04。 它也被configuration为一个DNS服务器(绑定),我的域名toto.be指向它。

我也安装了postfix,添加了mxlogging,添加了iptables规则,打开input端口53(udp + tcp)。

好吧,现在我正在testing。

  • 在我的服务器上,我可以发送一封电子邮件给本地用户root
  • 在我的服务器上,我可以发送电子邮件到外部电子邮件地址([email protected]
  • 从Gmail,我不能发送电子邮件到[email protected]

在我的日志

Oct 2 14:45:35 mail postfix/smtpd[31278]: connect from mail-qc0-x22b.google.com[2607:f8b0:400d:c01::22b] Oct 2 14:45:36 mail postfix/smtpd[31278]: NOQUEUE: reject: RCPT from mail-qc0-x22b.google.com[2607:f8b0:400d:c01::22b]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-qc0-x22b.google.com> Oct 2 14:45:36 mail postfix/smtpd[31278]: disconnect from mail-qc0-x22b.google.com[2607:f8b0:400d:c01::22b] 

在我的main.cf中,我尝试将google.com添加到mynetworks,但是我不认为这是解决scheme(针对所有其他域的解决scheme)?

 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 google.com 

现在该消息被接受但不能被传递

 Oct 2 14:49:09 mail postfix/smtpd[31484]: connect from mail-qg0-x231.google.com[2607:f8b0:400d:c04::231] Oct 2 14:49:10 mail postfix/smtpd[31484]: 541357F836: client=mail-qg0-x231.google.com[2607:f8b0:400d:c04::231] Oct 2 14:49:10 mail postfix/cleanup[31489]: 541357F836: message-id=<[email protected]> Oct 2 14:49:10 mail postfix/qmgr[31437]: 541357F836: from=<[email protected]>, size=1754, nrcpt=1 (queue active) Oct 2 14:49:10 mail postfix/smtp[31490]: 541357F836: to=<[email protected]>, relay=none, delay=0.31, delays=0.3/0/0/0, dsn=5.4.6, status=bounced (mail for toto.be loops back to myself) Oct 2 14:49:10 mail postfix/cleanup[31489]: 8EC927F83A: message-id=<[email protected]> Oct 2 14:49:10 mail postfix/bounce[31491]: 541357F836: sender non-delivery notification: 8EC927F83A Oct 2 14:49:10 mail postfix/qmgr[31437]: 8EC927F83A: from=<>, size=3676, nrcpt=1 (queue active) Oct 2 14:49:10 mail postfix/qmgr[31437]: 541357F836: removed Oct 2 14:49:10 mail postfix/smtpd[31484]: disconnect from mail-qg0-x231.google.com[2607:f8b0:400d:c04::231] Oct 2 14:49:11 mail postfix/smtp[31490]: 8EC927F83A: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[2a00:1450:400c:c02::1b]:25, delay=1, delays=0.03/0/0.17/0.83, dsn=2.0.0, status=sent (250 2.0.0 OK 1412254151 m13si5148612wjw.140 - gsmtp) Oct 2 14:49:11 mail postfix/qmgr[31437]: 8EC927F83A: removed 

我能做什么 ?

 postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix inet_interfaces = all mailbox_size_limit = 0 mydestination = smtp.toto.be, localhost, localhost.localdomain, localhost myhostname = smtp.toto.be mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 google.com myorigin = /etc/mailname readme_directory = no recipient_delimiter = + relayhost = smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes 

在/ etc /邮件名

 toto.be 

我看到的第一个问题是,您只允许发送电子邮件给smtp.toto.be; 有没有提到你接受交付toto.be,所以…

 myhostname = smtp.toto.be mydomain = toto.be mydestination = $myhostname, $mydomain, $mynetworks, localhost, localhost.localdomain myorigin = $mydomain 

有一件事是在postfix.conf中确保你有'myorigin'设置到你的域toto.be,以便本地用户映射到@ toto.be。 这可以通过几种方法来完成:

 myorigin = $mydomain 

(如果你有$ mydomain设置的地方),或者:

 myorigin = /etc/mailname 

(如果你有一个名为toto.be的/ etc / mailname文件作为第一行),或者甚至明确地像:

 myorigin = toto.be 

另外,错误'(toto.be的邮件循环回自己)'表示某些东西与路由混乱。 我有这个问题一次,发现从postfix.conf中删除'relayhost = $ myhostname'修复了它。

参考: http : //www.postfix.org/postconf.5.html#myorigin