2012年1月12日 星期四

SMTP server - Sendmail

Sendmail 官方網站:http://www.sendmail.org/
yum -y install sendmail sendmail-cf m4 cyrus-sasl
cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.bak
vim /etc/mail/sendmail.mc
#################################################################
52行 dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
53 行 dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
#刪掉上面兩行前面的 dnl
#注意:TRUST_AUTH_METH、define 前面不要留有空格
116行 dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
#前面加上 dnl, 把這行註解起來(dnl = do not load)
#或改成下面這樣也可以
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
#################################################### 
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.bak
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
vim /etc/mail/access
#####################################################
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
rexbode@walla.com                       DISCARD
35198347098vbr@yahoo.ie                 DISCARD
info@kia.com                            DISCARD
test@testing.domain.name                REJECT
from:35198347098vbr@yahoo.ie            DISCARD
from:rexbode@walla.com                  DISCARD
localhost.localdomain                   RELAY
localhost                               RELAY
127.0.0.1                               RELAY
wcjs.tcc.edu.tw                         RELAY
41.220.75                               DISCARD
163.17.209                              RELAY
# Connect:41.220.75                     REJECT
# onnect:163.17.209                     DISCARD
*.dynamic.*                             REJECT
h8h.com                             DISCARD
192.168.1.100                       DISCARD
from:info@cole.tw                       DISCARD
jessica.barry2009@hotmail.com           DISCARD
jessicabarry12@live.com                 DISCARD
info@winners.org                        DISCARD
info@cole.tw                            DISCARD
# info@kia.com                          DISCARD
# info@cole.tw                          DISCARD

##############################################################
 10 rexbode@walla.com                       DISCARD
 11 35198347098vbr@yahoo.ie                 DISCARD
 12 info@kia.com                            DISCARD
 13 test@testing.domain.name                REJECT
 14 from:35198347098vbr@yahoo.ie            DISCARD
 15 from:rexbode@walla.com                  DISCARD
 16 localhost.localdomain                   RELAY
 17 localhost                               RELAY
 18 127.0.0.1                               RELAY
 19 wcjs.tcc.edu.tw                         RELAY
 20 wcjs.tc.edu.tw                          RELAY
 21 41.220.75                               DISCARD
 22 163.17.209                              RELAY
 23 #Connect:41.220.75                      REJECT
 24 #onnect:163.17.209                      DISCARD
 25 *.dynamic.*                             REJECT
 26 h8h.com                             DISCARD
 27 192.168.1.100                       DISCARD
 28 from:info@cole.tw                       DISCARD
 29 jessica.barry2009@hotmail.com           DISCARD
 30 jessicabarry12@live.com                 DISCARD
 31 info@winners.org                        DISCARD
 32 info@cole.tw                            DISCARD
 33 #info@kia.com                           DISCARD
 34 #info@cole.tw                           DISCARD
 ###############################################################
makemap hash /etc/mail/access < /etc/mail/access
/etc/rc.d/init.d/saslauthd restart
/etc/rc.d/init.d/sendmail restart
chkconfig saslauthd on
chkconfig sendmail on
##############################################################
SMTP 測試:telnet IP 25(離開:quit)
把寄給 root 的信寄給 sysadm vim /etc/aliases
96行 #root: marc 修改成--> root: sysadm
#若想要 root 也留一份備份的話:root: cyl62,root
newaliases
mutt 介紹:yum -y install mutt && mutt
Sendmail 官方文件:http://www.sendmail.org/~ca/email/sm-X/

沒有留言:

張貼留言