我是 Postfix 的新手,直到现在我才开始使用 Exim,我无法在 Postfix 上进行配置,而我可以使用 Exim 进行配置
我有 3 个域名,每个域名有 5 个电子邮件地址
domain1.com 具有[电子邮件保护],[电子邮件保护]...[电子邮件保护] domain2.com 与[电子邮件保护],[电子邮件保护]...[电子邮件保护] domain3.com 与[电子邮件保护],[电子邮件保护]...[电子邮件保护]
对于每个用户,我都希望指定一个唯一的 IP 来发送电子邮件。他将连接到 smtpXX.domainX.com,并且我希望该外发电子邮件来自 smtpXX.domainX.com 的 IP,并且邮件 HELO 也为 smtpXX.domainX.com,
我到现在为止尝试了不同的解决方案,最后一个 https://serverfault.com/a/650326/443941 但仍然没有成功:
smtp 登录正在端口 587 上运行
我也设置了:
31.xx.xx.xx:submission inet n - n - - smtpd
我尝试从路由器后面的家用电脑连接,我尝试连接到smtp11.domain1.com其中 ip 是 31.xx.xx.189,通过我的 postfix 设置的接收头是正常的,但是接收服务器可以看到我的服务器的主机名 (server.hostname.com) 以及服务器的主 ip...下面是我得到的结果:
Received: from [31.xx.xx.85] (port=47010 helo=server.hostname.com)
by host.some-server.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
(Exim 4.89)
(envelope-from <[email protected]>)
id 1eEJd3-0004bH-0B
for [email protected]; Mon, 13 Nov 2017 20:38:41 +0200
Received: from [lo.cal.ip.add] (unknown [some.router.ip.addres])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
by smtp11.domain1.com (Postfix) with ESMTPSA id 0ABB627AXXXX
for <[email protected]>; Mon, 13 Nov 2017 20:37:43 +0200 (EET)
有人能帮我吗?我使用 Centos 7、postfix 2.10、virtualmin(我也在 CWP 上尝试过,结果相同)
更新
主配置文件
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost, server.myhostnamedomain.com, $mydomain
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = may
mailbox_size_limit = 0
allow_percent_hack = no
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
debug_peer_list = my-domain-1
主配置文件
127.0.0.1:smtp inet n - n - - smtpd
-o smtpd_sasl_auth_enable=yes
-o smtp_helo_name=localhost
-o smtp_bind_address=127.0.0.1
-o myhostname=localhost
31.xx.xx.85:smtp inet n - n - - smtpd
-o smtpd_sasl_auth_enable=yes
-o smtp_helo_name=smtp1.my-domain-1.com
-o smtp_bind_address=31.xx.xx.85
-o myhostname=smtp1.my-domain-1.com
31.xx.xx.189:smtp inet n - n - - smtpd
-o smtpd_sasl_auth_enable=yes
-o smtp_helo_name=smtp12.my-domain-1.com
-o smtp_bind_address=31.xx.xx.189
-o myhostname=smtp12.my-domain-1.com
127.0.0.1:submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtp_helo_name=localhost
-o smtp_bind_address=127.0.0.1
-o myhostname=localhost
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
31.xx.xx.85:submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtp_helo_name=smtp1.my-domain-1.com
-o smtp_bind_address=31.xx.xx.85
-o myhostname=smtp1.my-domain-1.com
-o smtpd_reject_unlisted_recipient=no
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
31.xx.xx.189:submission inet n - n - - smtpd
-o smtp_helo_name=smtp12.my-domain-1.com
-o smtp_bind_address=31.xx.xx.189
-o myhostname=smtp12.my-domain-1.com
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
127.0.0.1:smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtp_helo_name=localhost
-o smtp_bind_address=127.0.0.1
-o myhostname=localhost
-o smtpd_reject_unlisted_recipient=no
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
31.xx.xx.85:smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtp_helo_name=smtp1.my-domain-1.com
-o smtp_bind_address=31.xx.xx.85
-o myhostname=smtp1.my-domain-1.com
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
31.xx.xx.189:smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtp_helo_name=smtp12.my-domain-1.com
-o smtp_bind_address=31.xx.xx.189
-o myhostname=smtp12.my-domain-1.com
-o smtpd_reject_unlisted_recipient=no
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
relay unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
smtp-151060553215710 unix - - n - - smtp -o smtp_bind_address=31.xx.xx.189
依赖文件
@smtp12.my-domain-1.com smtp-151060553215710
电子邮件标题
Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: from host.host-for-reciving.com
by host.host-for-reciving.com with LMTP id eCEjEXO1Clq9TQAAIPTFlQ
for <[email protected]>; Tue, 14 Nov 2017 11:20:51 +0200
Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Tue, 14 Nov 2017 11:20:51 +0200
Received: from [31.xx.xx.85] (port=48868 helo=server.localdomain)
by host.host-for-reciving.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
(Exim 4.89)
(envelope-from <[email protected]>)
id 1eEXOl-0002TT-76
for [email protected]; Tue, 14 Nov 2017 11:20:51 +0200
Received: from [192.168.10.11] (unknown [external personal ip])
by smtp12.my-domain-1.com (Postfix) with ESMTPA id D56F32835F1C
for <[email protected]>; Tue, 14 Nov 2017 09:19:50 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp12.my-domain-1.com D56F32835F1C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=my-domain-1.com; s=default; t=1510651190;
bh=VazKNaSjnZAeKOSBMBWmlM99/xJ8HmJ4H2d+B/wNoE8=;
h=To:From:Subject:Date:From;
b=uaD3aX+xsVAqKjaqqZrcfG+83gR+nxdHicjxN48IpubMvfbOLR/+i3Mz6Gr2OBFAq
XRrSrxTe4LyM6V3mcY2sUo3i2f9LXS4Zktka1jsGI+IoduGvzTaa6c8pF0yn8u6N4a
xupaom0/++cCovIFUG03XCl+A4belApaM0nb7JfpLhkR9Q36BWkePdDLNPYe5/GjYN
noZTAZzPs9mYD8yc52l7NLpY+vxGr828649Yio8UAwKmzJirORBGKXeFoxvALtSi7z
klYtu+ZA+2TlekgWZHQvHbseAAH6XF8NQGYX9IE2kQ+fSEFOG6psqz1vzE/IRj/ZiT
G3oQzy02F/KFw==
To: [email protected]
From: Some Name <[email protected]>
Subject: sdadf
Message-ID: <[email protected]>
Date: Tue, 14 Nov 2017 11:19:49 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.4.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
sdfasdfasdf
答案1
看一眼Postfix 架构概述。在您master.cf
的smtpd
为接收使用不同的设置(IP 和协议)发送邮件。但是,Postfix交付使用不同的组件发送邮件:smtp
。
您需要配置其他 SMTP 客户端(传出运输) 在你的
master.conf
:smtp1-out unix - - n - - smtp -o smtp_bind_address=31.xx.xx.85 -o smtp_helo_name=smtp1.example.com -o syslog_name=postfix-smtp1 smtp12-out unix - - n - - smtp -o smtp_bind_address=31.xx.xx.189 -o smtp_helo_name=smtp12.example.com -o syslog_name=postfix-smtp12
然后您需要在以下位置配置发送方相关的传输图
main.cf
:sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport
您
/etc/postfix/sender_transport
需要将您的域映射到传输:# Use source IP - 31.xx.xx.85 @example.com smtp1-out: # Use source IP - 31.xx.xx.189 @example.net smtp12-out:
由于这是一种
hash:
类型查找表,sudo postmap /etc/postfix/sender_transport
。