Sat*_*ish 8 linux email-server smtp postfix
我已经安装了 postfix2.11.3并且我们的服务器上有多个 IP 地址,我们希望托管两个域,这些域是隔离的,并且在它们自己的 IP 上运行。
domain1 unix - - n - - smtp
-o smtp_bind_address=1.1.1.1
-o smtp_helo_name=mail.abc.com
-o syslog_name=postfix-mail.abc.com
domain2 unix - - n - - smtp
-o smtp_bind_address=2.2.2.2
-o smtp_helo_name=mail.xyz.com
-o syslog_name=postfix-mail.xyz.com
Run Code Online (Sandbox Code Playgroud)
以下传输器/etc/postfix/sender_transport也定义在main.cf:
@abc.com domain1:
@xyz.com domain2:
Run Code Online (Sandbox Code Playgroud)
重新启动 postfix 后,它停止监听端口25:
[root@postfix-2.11.3]# telnet 1.1.1.1 25
Trying 1.1.1.1...
telnet: connect to address 1.1.1.1: Connection refused
Run Code Online (Sandbox Code Playgroud)
但是,如果我在master.cf其中使用以下行,则在 25 上收听,如果我 telnet,则可以看到横幅:
1.1.1.1:smtp inet n - n - - smtpd -o myhostname=mail.abc.com
2.2.2.2:smtp inet n - n - - smtpd -o myhostname=mail.xyz.com
Run Code Online (Sandbox Code Playgroud)
但是我想告诉我的邮件服务器当你发送电子邮件时使用特定的域,就像 sender_transport
我在做什么错?
我已经从master.cf上面的域 1 和域 2 中删除并替换了以下行:
smtp inet n - n - - smtpd
Run Code Online (Sandbox Code Playgroud)
Sat*_*ish 15
/etc/postfix/master.cf
#smtp inet n - n - - smtpd
127.0.0.1:smtp inet n - n - - smtpd
-o syslog_name=postfix-localhost
-o smtp_helo_name=localhost
-o smtp_bind_address=127.0.0.1
-o myhostname=localhost
65.xxx.xxx.100:smtp inet n - n - - smtpd
-o syslog_name=postfix-mail.abc.com
-o smtp_helo_name=mail.abc.com
-o smtp_bind_address=65.xxx.xxx.100
-o myhostname=mail.abc.com
65.xxx.xxx.200:smtp inet n - n - - smtpd
-o syslog_name=postfix-mail.xyz.com
-o smtp_helo_name=mail.zyx.com
-o smtp_bind_address=65.xxx.xxx.200
-o myhostname=mail.xyz.com
abc-out unix - - n - - smtp
-o smtp_bind_address=65.xxx.xxx.100
-o smtp_helo_name=mail.abc.com
-o syslog_name=postfix-mail.abc.com
xyz-out unix - - n - - smtp
-o smtp_bind_address=65.xxx.xxx.200
-o smtp_helo_name=mail.xyz.com
-o syslog_name=postfix-mail.xyz.com
Run Code Online (Sandbox Code Playgroud)
/etc/postfix/main.cf
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport
Run Code Online (Sandbox Code Playgroud)
/etc/postfix/sender_transport
# Use source IP - 65.xxx.xxx.100
@abc.com abc-out:
@example.com abc-out:
# Use source IP - 65.xxx.xxx.200
@xyz.com xyz-out:
Run Code Online (Sandbox Code Playgroud)
运行命令以生成哈希数据库
postmap hash:/etc/postfix/sender_transport
Run Code Online (Sandbox Code Playgroud)
重新启动/重新加载后缀
service postfix reload
Run Code Online (Sandbox Code Playgroud)
测试
[root@localhost ~]# telnet 65.xxx.xxx.200 25
Trying 65.xxx.xxx.200...
Connected to 65.xxx.xxx.200.
Escape character is '^]'.
220 mail.xyz.com ESMTP Postfix
Run Code Online (Sandbox Code Playgroud)
发送邮件测试
[root@localhost ~]# telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost ESMTP Postfix
helo localhost
250 localhost
mail from: spatel@xyz.com
250 2.1.0 Ok
rcpt to: spatel@gmail.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Hello world!
.
250 2.0.0 Ok: queued as 93E708207BA
Run Code Online (Sandbox Code Playgroud)
转到 gmail 收件箱 > 显示原件
Delivered-To: spatel@gmail.com
Received: by 10.xxx.xxx.xxx with SMTP id w64csp782609qgd;
Tue, 9 Dec 2014 09:35:57 -0800 (PST)
X-Received: by 10.xxx.xxx.xxx with SMTP id o28mr4132552yha.168.1418146557180;
Tue, 09 Dec 2014 09:35:57 -0800 (PST)
Return-Path: <spatel@xyz.com>
Received: from mail.xyz.com ([65.xxx.xxx.200])
by mx.google.com with ESMTPS id n10si743294ykc.114.2014.12.09.09.35.56
for <spatel@gmail.com>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Tue, 09 Dec 2014 09:35:56 -0800 (PST)
...
...
Message-Id: <20141209173720.93E708207BA@localhost.localdomain>
Date: Tue, 9 Dec 2014 12:37:11 -0500 (EST)
From: spatel@xyz.com
Hello world!
Run Code Online (Sandbox Code Playgroud)
瞧!!看到它使用65.xxx.xxx.200IP地址发送电子邮件..
Received: from mail.xyz.com ([65.xxx.xxx.200])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20259 次 |
| 最近记录: |