具體步驟如下:
1、使用rpm命令是否有安裝Sendmail軟件
suining:~ # rpm -qa|grep sendmail
sendmail-devel-8.12.10-162.1
sendmail-8.12.10-162.1
suining:~ #
若如上,則已經安裝,若沒有信息出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤
2、我這裏已經安裝,接下來
使用rpm命令確認安裝了imap
suining:~ # rpm -qa|grep imap
php4-imap-4.3.4-43.8
imap-lib-2002e-92.1
imap-2002e-92.1
imap-devel-2002e-92.1
若如上,則已經安裝,若沒有信息出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤
使用rpm命令確認安裝了pop
suining:/etc/xinetd.d # rpm -qa|grep pop
popt-1.7-176.7
qpopper-4.0.5-175.1
若如上,則已經安裝,若沒有信息出來,則使用YAST來進行安裝,期間會提示插入相應安裝盤
3、修改/etc/sysconfig/mail這個配置文件,是本機以外的人可以使用該服務器EMAIL,如下:
suining:/etc/sysconfig # more mail
## Path: Network/Mail/General
## Description:
## Type: string
## Default: ""
## Config: postfix
## ServiceReload: sendmail,postfix
#
# From:-Line in email and News postings
# (otherwise the FQDN is used)
#
FROM_HEADER=""
## Path: Network/Mail/General
## Description: General configuration of mail interface
## Type: yesno
## Default: yes
## Config: sendmail,postfix
#
# If you don't want to let SuSEconfig generate your
# configuration file, set this to no
#
MAIL_CREATE_CONFIG="yes"
## Type: yesno
## Default: no
## Config: postfix
#
# Set this to "yes" if mail from remote should be accepted
# this is necessary for any mail server.
# If set to "no" or empty then only mail from localhost
# will be accepted.
#
SMTPD_LISTEN_REMOTE="yes" ----原來是no,一定要改成yes才能讓其它外部PC使用該EMIAL服務器發郵件
4、修改Linux.mc設定檔,編輯/etc/mail/Linux.mc文件
在83%處將:
dnl FEATURE(`authinfo', `hash -o 'AUTH_DIR`/auth-info')dnl
修改爲:
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')d
nl
在86%處將:
dnl TRUST_AUTH_MECH(`place_here_your_auth_mechanism')dnl
dnl define(`confAUTH_MECHANISMS', `place_here_your_auth_mechanism')dnl
修改爲:
TRUST_AUTH_MECH(`place_here_your_auth_mechanism')dnl
define(`confAUTH_MECHANISMS', `place_here_your_auth_mechanism')dnl
然後:
suining:/etc/mail # m4 /etc/mail/linux.mc > /etc/sendmail.cf
生成可用的sendmail.cf
5、編輯/etc/sendmail.cf文件,如下
在13%處,將:
# SMTP client options
#O ClientPortOptions=Family=inet, Address=0.0.0.0
修改爲:
# SMTP client options
O ClientPortOptions=Family=inet, Address=10.38.223.195 ---本機的IP
6、編輯/etc/mail/local-host-names,加入本機域名
# Format:
#
#<aliases for local host>
mail.sina.com
sina.com
7、編輯/etc/mail/access,加入
# Default for loop back is RELAY
127 RELAY
10.38.223 RELAY
允許10.38.223地址段的郵件轉發
然後:
suining:/etc/mail # makemap hash /etc/mail/access.db < /etc/mail/access
將access裏的文件內容轉化爲/etc/mail/access.db資料庫
8、suining:/etc/mail # chkconfig --level 35 sendmail on
suining:/etc/mail #
運行3,5級別下讓sendmail服務開機自動加載
9、查看/etc/services,確保:
smtp 25/tcp mail # Simple Mail Transfer
smtp 25/udp mail # Simple Mail Transfer
和
pop3 110/tcp # Post Office Protocol - Version 3
pop3 110/udp # Post Office Protocol - Version 3
前的#號沒有被註釋掉
10、編輯/etc/xinetd.d下的imap文件,修改如下:
# imap - imap mail daemon
#
service imap
{
disable = yes ---------修改爲no
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/imapd
flags = IPv4
}
編輯/etc/xinetd.d下的qpopper文件,修改如下:
# qpopper - pop3 mail daemon
#
service pop3
{
disable = yes ----------修改爲no
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/popper
server_args = -s
flags = IPv4
}
~
接着重新啓動xinetd
suining:/etc/init.d # ./xinetd restart
Shutting down xinetd: done
Starting INET services. (xinetd) done
suining:/etc/init.d #
使用如下命令查看狀態
suining:/usr/sbin # ./ipop3d status
+OK POP3 suining.js v2003.83 server ready
suining:/usr/sbin # ./imapd status
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS LOGINDISABLED] suining.js IMAP4rev1 2003.339 at Sun, 6 Jul 2008 14:30:06 -0700 (PDT)
11、最後重新啓動Sendmail服務
suining:/etc/init.d # ./sendmail start
Initializing SMTP port (sendmail) done
suining:/etc/init.d #
12、先本機測試:
suining:~ # telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:41:47 -0700
ehlo aa
250-suining.js Hello localhost [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 suining.js closing connection
Connection closed by foreign host.
說明服務成功啓動,並且本機可以使用
suining:~ # telnet 10.38.223.195 25
Trying 10.38.223.195...
Connected to 10.38.223.195.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:42:35 -0700
ehlo bb
250-suining.js Hello suining.js [10.38.223.195], 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 suining.js closing connection
Connection closed by foreign host.
說明其它PC可以通過該IP來使用EMAIL服務
suining:~ # telnet mail.sina.com 25
Trying 10.38.223.195...
Connected to mail.sina.com.
Escape character is '^]'.
220 suining.js ESMTP Sendmail 8.12.10/8.12.10/SuSE Linux 0.7; Sun, 6 Jul 2008 14:43:41 -0700
ehlo cc
250-suining.js Hello suining.js [10.38.223.195], 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 suining.js closing connection
Connection closed by foreign host.
說明可以通過域名來使用
然後可以創建用戶,使用WINDOWS的outlook客戶端來做測試。
記住:一定要在/etc/hosts裏添加類似如下行
192.168.1.106 study.zzjtlxs.com study