我一直在试图设置一个新的邮件服务器从我的VPS迁移,因为我的主机已经决定closures它的大门。 旧的服务器运行的是Exim / Courier(现在已经有近十年的历史了),我觉得Postfix / Dovecot会更简单。 虽然我没有那么多运气。
我正在设置什么:
我一直在使用Amavis将ClamAV和SpamAssassin绑在一起。
postconf -n:
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix content_filter = smtp-amavis:[127.0.0.1]:10024 home_mailbox = Maildir/ inet_interfaces = all mailbox_command = /usr/lib/dovecot/deliver mailbox_size_limit = 0 milter_default_action = accept mydestination = localhost, /etc/postfix/domains myhostname = example.org mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname readme_directory = no recipient_delimiter = + relayhost = smtp_tls_security_level = may smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) smtpd_client_restrictions = reject_unknown_client_hostname, permit_sasl_authenticated smtpd_data_restrictions = reject_unauth_pipelining smtpd_helo_required = yes smtpd_helo_restrictions = reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname smtpd_recipient_restrictions = permit_mynetworks, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_sasl_authenticated, reject_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_path = private/auth smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_sender_restrictions = reject_unknown_sender_domain smtpd_tls_auth_only = yes smtpd_tls_cert_file = /etc/postfix/.pem smtpd_tls_key_file = /etc/postfix/.key smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtpd_use_tls = yes virtual_alias_maps = hash:/etc/postfix/virtual
/等/后缀/域:
lorem.com example.org website.net
/等/后缀/虚拟:
[email protected] userTwo [email protected] userTwo [email protected] userOne [email protected] userOne [email protected] userOne [email protected] userOne [email protected] userThree [email protected] userTwo
将邮件从[email protected]发送到[email protected]时:
mail.log,mail.err:
Aug 3 20:04:55 example postfix/submission/smtpd[25424]: connect from my-hostname[68.xxx.xxx.xxx] Aug 3 20:04:55 example postfix/submission/smtpd[25424]: 8D70441402: client=my-hostname[68.xxx.xxx.xxx], sasl_method=PLAIN, sasl_username=userOne Aug 3 20:04:55 example postfix/cleanup[25429]: 8D70441402: message-id=<[email protected]> Aug 3 20:04:55 example postfix/qmgr[25311]: 8D70441402: from=<[email protected]>, size=583, nrcpt=1 (queue active) Aug 3 20:04:55 example postfix/submission/smtpd[25424]: disconnect from my-hostname[68.xxx.xxx.xxx] Aug 3 20:04:56 example postfix/smtpd[25434]: connect from localhost[127.0.0.1] Aug 3 20:04:56 example postfix/smtpd[25434]: 72CE941403: client=localhost[127.0.0.1] Aug 3 20:04:56 example postfix/cleanup[25429]: 72CE941403: message-id=<[email protected]> Aug 3 20:04:56 example postfix/qmgr[25311]: 72CE941403: from=<[email protected]>, size=991, nrcpt=1 (queue active) Aug 3 20:04:56 example postfix/smtpd[25434]: disconnect from localhost[127.0.0.1] Aug 3 20:04:56 example amavis[5148]: (05148-07) Passed CLEAN {RelayedInbound}, [68.xxx.xxx.xxx]:52874 [68.xxx.xxx.xxx] <[email protected]> -> <[email protected]>, Queue-ID: 8D70441402, Message-ID: <[email protected]>, mail_id: QciSwqBl84A4, Hits: 1.439, size: 583, queued_as: 72CE941403, 838 ms Aug 3 20:04:56 example postfix/smtp[25430]: 8D70441402: to=<[email protected]>, orig_to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=1, delays=0.13/0.01/0.01/0.84, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 72CE941403) Aug 3 20:04:56 example postfix/qmgr[25311]: 8D70441402: removed Aug 3 20:04:56 example dovecot: lda(steve): msgid=<[email protected]>: saved mail to INBOX Aug 3 20:04:56 example postfix/local[25377]: 72CE941403: to=<[email protected]>, relay=local, delay=0.12, delays=0.01/0/0/0.1, dsn=2.0.0, status=sent (delivered to command: /usr/lib/dovecot/deliver) Aug 3 20:04:56 example postfix/qmgr[25311]: 72CE941403: removed
我审查了我的IP和主机名。 现在,请注意中间的那一行,它表示orig_to。 当我收到电子邮件时,它位于[email protected]的SENT框中。 这很奇怪,不是吗? SMTP从[email protected]到[email protected]工作正常。
我发现另外一个与此相符的问题:
Postfix:virtual_alias_maps尽pipe有新的域名,但把一切交给一个用户
不幸的是,我不明白答案,我不相信我们的设置是相同的。
所以我认为它必须与我的目的和我的虚拟地图的使用…但我不太清楚如何设置我的目的地和虚拟域,如果我迄今为止做了什么不工作。
我一直在寻找这个看起来很容易的问题的答案很长一段时间,我没有办法解决。 我不想让Google运行我的邮件,而且我真的希望让它在这个VPS上运行。
任何帮助将不胜感激。 谢谢。
我相信我已经解决了这个问题,并且希望这可以帮助那些遇到这个问题的人。 有些失望的是,这里没有太多的帮助,但我认为写出来可能有帮助。 无论如何:
在main.cf , myorigin和mydestinationvariables需要设置为localhost。 所以:
myorigin = localhost mydestination = localhost
切换到虚拟域映射允许虚拟用户获得他们需要的邮件,而不是使用mydestination处理域分配。
virtual_alias_domains = hash:/etc/postfix/domains
这意味着我们还需要正确地格式化/etc/postfix/domains文件:
example.org # example.com #
评论只是完成哈希格式,没有更多。 这个文件也需要postmap :
postmap /etc/postfix/domains
应该是这样的。 所有的个人帐户将通过虚拟域查找完成后,将电子邮件路由到正确的Unix地址。
我仍然不知道对用户“扩展”的是什么,或者是有其他人遇到什么麻烦,但是对于这个特定的问题似乎并不重要。
我希望这能帮助像我这样的其他人。
编辑:同时删除/etc/aliases中的所有内容。