[轉帖]Sendmail 的一些設定

Home Home
引用 | 編輯 pigpig5442
2005-03-19 14:06
樓主
推文 x0
Sendmail

一、啟動與安裝

(一) 啟動

1. /etc/rc.d/init.d/sendmail start

2. ntsysv 設定系統服務程式 : 開機時啟動

(二) 安裝

1. rpm –ivh sendmail-8.12.8-4.i386.rpm

二、設定

(一) 轉遞(Relay)別台主機發送的信件

1. 編輯 /etc/mail/sendmail.cf

DaemonPortOptions=Port=smtp,Addr=0.0.0.0, Name=MTA

( 將預設的 ”127.0.0.1” 改成 “0.0.0.0” )

2. 編輯 /etc/mail/access (裡面內容是郵件主機可relay的對象)

ntu.edu.tw RELAY( relay *.ntu.edu.tw 的信件 )

140.112 RELAY( relay 140.112.* .* 的信件 )

3. 重新啟動sendmail

/etc/rc.d/init.d/sendmail restart

(二)檢視寄信狀況

1. 指令:mailq

(如果有信尚未寄出去,則會顯示

郵件編號、郵件大小、進入queue的時間、收信人、寄信人等資料)

2. 郵件佇列中的信件都存在 /var/spool/mqueue目錄中

3. 在郵件主機上收發郵件的動作,會紀錄在 /var/log/maillog檔中

三、安裝可從Windows讀信的POP/IMAP伺服器

(一)安裝POP與IMAP伺服器

1. mount /mnt/cdrom

2. cd /mnt/cdrom/RedHat/RPMS

3. rpm –i imap-2001a-18.i386.rpm

(二)設定

1. 編輯 /etc/services (確定有以下內容且未被加上”#”符號)

pop2 109/tcp pop-2 postoffice # POP version 2

pop2 109/tcp pop-2

pop3 110/tcp pop-3 #POP version 3

‧ ‧‧

imap 143/tcp imap2 #Interim Mail Access Proto v2

imap 143/udp imap2

2. 修改POP與IMAP設定檔 /etc/xinetd.d/ipop3

/etc/xinetd.d/ipop2

/etc/xinetd.d/imap

disable = no (預設為yes,改為no)

3. 啟動 /etc/rc.d/init.d/xinetd reload

四、檢查伺服器名稱是否正確

1. host -t mx xxx.csie.ntu.edu.tw

(如果沒有,mail server只能發信,不能收信)



五、寄信

1. 建立連線 telnet xxx.xxx.xxx.xxx 25

2. 介紹自己所在地 HELO xxx.xxx.xxx.xxx

3. MAIL FROM: xxx@xxx.xxx.xxx

4. RCPT TO: xxx@xxx.xxx.xxx

5. DATA

6. “信的內容” (最後一行只打 ”.” 離開)

7. QUIT

六、收信

1. 建立連線 telnet xxx.xxx.xxx.xxx 110

2. USER xxxxx

3. PASS xxxxxx

4. LIST

5. RETR x (x是數字,要看哪一封)

6. DELE x 刪除郵件

7. QUIT



FETCHMAIL

一、ISP公司:

1. /etc/mail/virtusertable

加入 “ @your.domain.name isp_account@isp.net
2. makemap -r hash /etc/mail/virtusertable.db < /etc/mail/virtusertable
二、自己:

1. /etc/sendmail.cf (大約在 91 ﹑136﹑141 和 1032 行)

......
Dj$w.your.domain.name
......
#CL root
#CE root
CM root
......
DMyour.domain.name
......
R$* $#error $@ 5.7.1 $: "550 Relaying denied"
......
2. 重新啟動 sendmail /etc/rc.d/init.d/sendmail restart

3. 在 root 的家目錄建立檔案﹕.fetchmailrc (別少了前面的‘.’﹗)

set postmaster "postmaster"
poll mail.isp.net with proto POP3
localdomains your.domain.name
user "isp_account" there with password "hBg7-rE10" is * here options fetchall
4. 避免其它使用者看到您的 ISP 帳號和密碼chmod 0600 .fetchmailrc

5. 使用定時器來設定 fetchmail 的執行動作 crontab –e

加入0,20,40 * * * * /usr/bin/fetchmail -v

獻花 x0
引用 | 編輯 ccxxx
2005-03-23 01:31
1樓
  
Using command line is quite difficult.
I prefer use webmin - http://www.webmin.com/
It is really useful for who don't know how to config sendmail in file / command line.
Moreove, it can be used to config many services in linux as well as hardware.

獻花 x0
引用 | 編輯 abubt
2005-04-02 04:28
2樓
  
呵呵呵~對啊~使用webmin來管理真的是方便多了~像我這個新手~
都是一邊使用webmin來設定,但是設定完後都盡量的找出那個動作
在command line下是如何運作的,順便更了解linux,而且在一些人面
前這樣用會讓別人覺的你是高手的感覺~(自爆~>_<~),當然~我還
有得學呢~cc

獻花 x0