分类: LINUX
2009-11-02 00:15:13
搭建无DNS的Sendmail服务器
配置mail.jaylin.com服务器
# vi /etc/mail/sendmail.cf
# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
O ServiceSwitchFile=/etc/mail/service.switch
# hosts file (normally /etc/hosts)
O HostsFile=/etc/hosts
# touch service.switch
# vi service.switch
hosts files
aliases files
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.2.11 mail.xin.com xin.com
# vi /etc/mail/access
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
to:xin.com RELAY
to:jaylin.com OK
# vi /etc/mail/local-host-names
清空
配置mail.xin.com服务器
# vi /etc/mail/sendmail.cf
# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
O ServiceSwitchFile=/etc/mail/service.switch
# hosts file (normally /etc/hosts)
O HostsFile=/etc/hosts
# touch service.switch
# vi service.switch
hosts files
aliases files
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.9 mail.jaylin.com jaylin.com
# vi /etc/mail/access
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
to:xin.com OK
to:jaylin.com RELAY
# vi /etc/mail/local-host-names
清空
测试环境
1. 从客户端client.jaylin.com通过telnet方式到mail.jaylin.com的25端口,以jaylin用户向mail.xin.com服务器上的xin用户发送邮件。客户端client.xin.com通过telnet方式到mail.xin.com的110端口查收邮件。
在client.jaylin.com上发送邮件:
# telnet 192.168.1.9 25
Trying 192.168.1.9...
Connected to 192.168.1.9 (192.168.1.9).
Escape character is '^]'.
220 mail.jaylin.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 20 Oct 2009 12:37:51 +0800
MAIL FROM:jaylin@jaylin.com
250 2.1.0 jaylin@jaylin.com... Sender ok
RCPT TO:xin@xin.com
250 2.1.5 xin@xin.com... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
SUBJECT xin
hehe~
.
250 2.0.0 n9K4bp5I003364 Message accepted for delivery
quit
221 2.0.0 mail.jaylin.com closing connection
Connection closed by foreign host.
在client.xin.com上接受邮件:
# telnet 192.168.2.11 110
Trying 192.168.2.11...
Connected to 192.168.2.11 (192.168.2.11).
Escape character is '^]'.
+OK Dovecot ready.
User xin
+OK
Pass ******
+OK Logged in.
List
+OK 3 messages:
1 621
2 624
3 619
.
retr 3
+OK 619 octets
Return-Path:
Received: from mail.jaylin.com (mail.jaylin.com [192.168.1.9])
by mail.xin.com (8.13.8/8.13.8) with ESMTP id n9K71HTK003515
for
Received: from [192.168.1.7] ([192.168.1.7])
by mail.jaylin.com (8.13.8/8.13.8) with SMTP id n9K4bp5I003364
for xin@xin.com; Tue, 20 Oct 2009 12:38:03 +0800
Date: Tue, 20 Oct 2009 12:37:51 +0800
From: jaylin@mail.jaylin.com
Message-Id: <200910200438.n9K4bp5I003364@mail.jaylin.com>
X-Authentication-Warning: mail.jaylin.com: [192.168.1.7] didn't use HELO protocol
SUBJECT xin
hehe~
.
quit
+OK Logging out.
Connection closed by foreign host.
2. 从客户端client.xin.com通过telnet方式到mail.xin.com的25端口,以xin用户向mail.jaylin.com服务器上的jaylin用户发送邮件。客户端client.jaylin.com通过telnet方式到mail.jaylin.com的110端口查收邮件。
在client.xin.com上发送邮件:
# telnet 192.168.2.11 25
Trying 192.168.2.11...
Connected to 192.168.2.11 (192.168.2.11).
Escape character is '^]'.
220 mail.xin.com ESMTP Sendmail 8.13.8/8.13.8; Tue, 20 Oct 2009 15:01:58 +0800
MAIL FROM:xin@xin.com
250 2.1.0 xin@xin.com... Sender ok
RCPT TO:jaylin@jaylin.com
250 2.1.5 jaylin@jaylin.com... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
SUBJECT jaylin
heihei~
.
250 2.0.0 n9K71wsJ003524 Message accepted for delivery
quit
221 2.0.0 mail.xin.com closing connection
Connection closed by foreign host.
在client.jaylin.com上接受邮件:
# telnet 192.168.1.9 110
Trying 192.168.1.9...
Connected to 192.168.1.9 (192.168.1.9).
Escape character is '^]'.
+OK Dovecot ready.
User jaylin
+OK
Pass ******
+OK Logged in.
List
+OK 3 messages:
1 2532
2 615
3 613
.
retr 3
+OK 613 octets
Return-Path:
Received: from mail.xin.com (mail.xin.com [192.168.2.11])
by mail.jaylin.com (8.13.8/8.13.8) with ESMTP id n9K4dB1c003369
for
Received: from [192.168.2.8] ([192.168.2.8])
by mail.xin.com (8.13.8/8.13.8) with SMTP id n9K71wsJ003524
for jaylin@jaylin.com; Tue, 20 Oct 2009 15:02:08 +0800
Date: Tue, 20 Oct 2009 15:01:58 +0800
From: xin@mail.xin.com
Message-Id: <200910200702.n9K71wsJ003524@mail.xin.com>
X-Authentication-Warning: mail.xin.com: [192.168.2.8] didn't use HELO protocol
SUBJECT jaylin
heihei~
.
quit
+OK Logging out.
Connection closed by foreign host.