> [yum]
> baseurl=file:///media
> enabled=1
> EOF
===========================================================================
[root@localhost Server]#
/etc/init.d/sendmail restart
[root@localhost Server]#
/etc/init.d/dovecot restart
[root@localhost Server]# netstat ?ntla
#使用netstat命令测试是否开启SMTP的25端口、POP3的110端口及IMAP的143端口
Active Internet connections (servers
and established)
Proto Recv-Q Send-Q
Local
Address
Foreign
Address
State
tcp
0 0
0.0.0.0:111
0.0.0.0:*
LISTEN
tcp
0 0
127.0.0.1:631 0.0.0.0:* LISTEN
tcp
0 0
0.0.0.0:25 0.0.0.0:*
LISTEN
tcp
0 0
0.0.0.0:795 0.0.0.0:*
LISTEN
tcp
0 0
:::993
:::*
LISTEN
tcp
0 0
:::995
:::*
LISTEN
tcp
0 0
:::110
:::*
LISTEN
tcp
0 0
:::143
:::*
LISTEN
tcp
0 0
:::22
:::*
LISTEN
[root@localhost Server]# telnet
localhost 25 #验证Sendmail的SMTP认证功能
Trying 127.0.0.1...
Connected to localhost.localdomain
(127.0.0.1).
Escape character is '^]'.
220 localhost.localdomain ESMTP
Sendmail 8.13.8/8.13.8; Thu, 2 Sep 2010 21:09:54 -0700
ehlo localhost #验证Sendmail的SMTP认证功能
250-localhost.localdomain Hello
localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
quit
221 2.0.0 localhost.localdomain closing
connection
Connection closed by foreign host.
===========================================================================
[root@localhost Server]# telnet
localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain
(127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.
===========================================================================
创建用户账号
注:sendmail服务器使用linux系统中的用户账号作为邮件账号,因此为用户添加邮件账号只需要添加linux用户账号即可。为了便于对邮件用户进行管理,由于邮件账号通常不需要登录linux系统,因此可以在adduser命令使用“-s”选项指定用户的shell为“/sbin/nologin”,即不允许用户登录linux系统。在建立邮件用户账号之后,需要使用passwd命令为用户设置口令,以便用户发送和收取邮件时进行身份认证。
[root@localhost Server]# useradd
user1
[root@localhost Server]# useradd
user2
[root@localhost Server]# su user1
[user1@localhost Server]$ mail -vs
"what is the weather like today?" user2@gd2010.com
do you know ? i love you
.
Cc:
user2@gd2010.com... Connecting to
[127.0.0.1] via relay...
220 localhost.localdomain ESMTP
Sendmail 8.13.8/8.13.8; Fri, 3 Sep 2010 05:32:24 -0700
>>> EHLO
localhost.localdomain
250-localhost.localdomain Hello
localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL
From: SIZE=103
250 2.1.0
... Sender ok
>>> RCPT
To:
>>> DATA
250 2.1.5 ...
Recipient ok
354 Enter mail, end with "." on a line
by itself
>>> .
250 2.0.0 o83CWOAA010249 Message
accepted for delivery
user2@gd2010.com... Sent
(o83CWOAA010249 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing
connection
===========================================================================
[user1@localhost Server]$ su user2
Password:
[user2@localhost Server]$ cat
/var/spool/mail/user2
From user1@localhost.localdomain
Fri Sep 3 05:32:24 2010
Return-Path:
Received: from localhost.localdomain
(localhost.localdomain [127.0.0.1])
by
localhost.localdomain (8.13.8/8.13.8) with ESMTP id
o83CWOAA010249
for
; Fri, 3 Sep 2010 05:32:24 -0700
Received: (from user1@localhost)
by
localhost.localdomain (8.13.8/8.13.8/Submit) id o83CWONV010248
for
user2@gd2010.com; Fri, 3 Sep 2010 05:32:24 -0700
Date: Fri, 3 Sep 2010 05:32:24
-0700
From: user1@localhost.localdomain
Message-Id:
<201009031232.o83CWONV010248@localhost.localdomain>
To: user2@gd2010.com
Subject: what is the weather like
today?
do you know ? i love you
===========================================================================
[root@localhost Server]# cat
/var/log/maillog
#所有信息都存储在这个日志文件中,包括用户名,主机名,出错代码。这些出错代码很有用处,可以通过这些让你对自己有更好的了解
Sep 3 05:32:24 localhost
sendmail[10248]: o83CWONV010248: from=user1, size=103,
class=0, nrcpts=1, msgid=<201009031232.o83CWONV010248@localhost.localdomain>,
relay=user1@localhost
Sep 3 05:32:24 localhost
sendmail[10249]: o83CWOAA010249:
from=, size=392,
class=0, nrcpts=1,
msgid=<201009031232.o83CWONV010248@localhost.localdomain>,
proto=ESMTP, daemon=MTA, relay=localhost.localdomain
[127.0.0.1]
Sep 3 05:32:24 localhost
sendmail[10248]: o83CWONV010248: to=user2@gd2010.com, ctladdr=user1
(501/501), delay=00:00:00, xdelay=00:00:00,
mailer=relay, pri=30103, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0,
stat=Sent (o83CWOAA010249 Message accepted for delivery)
Sep 3 05:32:24 localhost
sendmail[10250]: o83CWOAA010249:
to=, ctladdr=
(501/501), delay=00:00:00, xdelay=00:00:00, mailer=local,
pri=30602, dsn=2.0.0, stat=Sent