rpm -q sendmail
還需安裝這三個包
sendmail-cf-8.12.8-4.i386
sendmail-devel-8.12.8-4.i
sendmail-doc-8.12.8-4.i38
安裝好后,我開始配置文件,,,,,
修改/etc/mail/local-hosts-name文件
[root@localhost named]# cat /etc/mail/local-host-names
# local-host-names - include all aliases for your machine here.
xuwini.com
更改/etc/mail/sendmail.mc文件,修改下列地方:
DaemonPortsOptions=Port=smtp,Addr=127.0.0.1, Name=MTA 更改為:
DaemonPortsOptions=Port=smtp,Addr=yourip或者0.0.0.0, Name=MTA
然后m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
修改 /etc/rc.d/rc.local
加入一行 /usr/sbin/saslauthd -a shadow
用戶管理
認(rèn)證的配置:修改/etc/mail/sendmail.mc中的字段,取消“TRUST_AUTH_MECH”一行和下一行“define”處的注釋。然后m4 /etc/ mail/sendmail.mc>/etc/mail/sendmail.cf。
[root@localhost named]# chkconfig --list saslauthd 開啟認(rèn)證
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@localhost named]# chkconfig --level 35 saslauthd on
建立用戶帳號
[root@localhost named]# groupadd mailuser
[root@localhost named]# adduser -g mailuser -s /bin/bash xuwin
[root@localhost named]# adduser -g mailuser -s /sbin/nologin xxx
[root@localhost named]# passwd xuwin
[root@localhost named]# passwd xxx 密碼都是123
【修改/etc/aliases文件實現(xiàn)郵件轉(zhuǎn)發(fā)和郵件列表:
admin: xxx 為郵件用戶xxx設(shè)置別名admin
testgroup: xuwin,xxx 實現(xiàn)群發(fā) 發(fā)給testgroup的郵件發(fā)給xuwin 和 xxx 以上2個可以分別測試
#newaliases 】 -------對于我們簡單的郵件體系沒什么大的用處,個人覺得
訪問控制設(shè)置
更改/etc/mail/accesss文件,增加:
[root@localhost named]# cat /etc/mail/access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
xuwin.com RELAY
完成后makemap hash /etc/mail/access.db < /etc/mail/access進(jìn)行數(shù)據(jù)庫更新。
#service sendmail restart
已經(jīng)成功進(jìn)入。。。。
我們試著來寫一份簡單的信。。。
那么我在服務(wù)器上收信看看。。。。暈倒。。把密碼打出啦。。。
[root@localhost root]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.12.8/8.12.8; Sun, 10 Aug 2008 20:47:0
6 +0800
mail from: root@xuwin.com
250 2.1.0 root@xuwin.com... Sender ok
rcpt to: xuwin@xuwin.com
250 2.1.5 xuwin@xuwin.com... Recipient ok
data
354 Enter mail, end with "." on a line by itself
test
hi.baidu.com/proxuwin
xuwin.com
.
250 2.0.0 m7ACl6B7004271 Message accepted for delivery
quit
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.
檢查日志[root@localhost root]# tail /var/log/maillog
你如果想在客戶機上收發(fā)郵件,那么還需跟著我做。。呵呵。。。上面算是成功了,我們看看接下來會不會成功。。。。期待。。
檢測imap是否安裝rpm -q imap
安裝rpm -ivh imap-*.rpm
[root@localhost root]# chkconfig imap on
[root@localhost root]# service xinetd restart
停止 xinetd: 確定 ]
啟動 xinetd: 確定 ]
[root@localhost root]# grep imap /etc/services
imap 143/tcp imap2 # Interim Mail Access Proto v2
imap 143/udp imap2
imap3 220/tcp # Interactive Mail Access
imap3 220/udp # Protocol v3
imaps 993/tcp # IMAP over SSL
imaps 993/udp # IMAP over SSL
有錯誤。。。那么就仔細(xì)檢查一下,我們剛剛的配置
看了一下,我把網(wǎng)絡(luò)服務(wù)重啟了一下。。不知道行不行。。。呵呵
我們繼續(xù)。。。。我估計是imap沒配置好,因為可以發(fā)送的。。。。
你們看。。。沒出錯。。完全是可行的。。。。這個就是我們剛剛發(fā)的。。。。
。。。。功夫不負(fù)有心人 啊。。找到原因了。。。呵呵。。 /sbin/chkconfig imap on。。。。。。是imap沒啟動。。。暈倒。。。
收到信了把。。。。
當(dāng)然我們不可能在一臺服務(wù)器上那么瞎搞,一般都是兩臺兩個域進(jìn)行郵件交互。。。方法跟這個是一樣的。。大家可以試試。。。呵呵。。。。
教程到此,不好意思,浪費大家那么多的時間在找錯誤上。。。。
posted on 2009-06-06 19:22 Blog of JoJo 閱讀(369) 評論(0) 編輯 收藏 所屬分類: Linux 技術(shù)相關(guān) 、每日一記 、Tool 安裝應(yīng)用