看板SetupBBS
標 題[轉錄][beta] BBS 收站外信件
發信站豬頭紀公園 (Mon Oct 20 14:20:27 2003)
轉信站ptt!ctu-reader!ctu-peer!news.nctu!netnews.csie.nctu!news.cs.nthu!PigHe
※ [本文轉錄自 shakalaca 看板]
作者: shakalaca (Lord Of The BBS :D) 看板: shakalaca
標題: [beta] BBS 收站外信件
時間: Mon Oct 20 11:57:38 2003
BBS 收站外信完全手冊
====================
※ 版本
2003.10.20 初稿
※ 作者
Jian-Zhou Huang <
[email protected]>
※ 參考文件
* php.twbbs.org / Plan: 看板 &
php.twbbs.org / InstallBBS: 看板 &
※ 大綱
0) 操作環境
1) 使用 sendmail
2) 使用 postfix
※ 操作環境
下面的操作使用 FreeBSD 5.1, sendmail 已經內建, 而 postfix 使用 ports 安裝.
通常作業系統都已經內建 sendmail, 如果你想要使用 postfix 取代 sendmail,
可以在網路上找到不少中文的安裝文件, 在這邊就不多提了. :)
適用的 BBS 有:
Maple 及其延伸版本 (PACK, WindTop)
Ptt 系列
WD 系列
SOB 系列
Firebird 系列
※ 使用 sendmail
設定 cf 檔的目錄在 /usr/share/sendmail/cf
顏色的說明如下:
1) 使用 Firebird 與 Ptt 系列只要加入白色部分.
Firebird 請將 A=bbsmail $u 改為 A=bbsmail -d $u
2) 使用 SOB, Atlantis, WD 除了白色還要加入紅色部分.
3) 如果使用 MapleBBS 系列, 除了白色紅色, 請加入黃色部分.
有幾個地方要注意:
1) /home/bbs 請換成你的 BBS 家目錄
2) 欄位之間請用 tab 而非空白鍵
* 方法一: 利用 m4
切換到設定 cf 檔的目錄, 首先將下面的檔案存為 mailer/bbs.m4
==========================[我是bbs.m4的分隔線]=============================
PUSHDIVERT(-1)
#
# Copyright (c) 1999 Ying-Chieh Liao (ijliao). All rights reserved.
# Copyright (c) 1998 Yen-Ming Lee (Leeym). All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#
ifdef(`BBSMAIL_PATH',, `define(`BBSMAIL_PATH', /home/bbs/bin/bbsmail)')
ifdef(`BBSMAIL_FLAGS',, `define(`BBSMAIL_FLAGS', `lsSDFMhPu')')
ifdef(`BBSMAIL_ARGS',, `define(`BBSMAIL_ARGS', `bbsmail')')
ifdef(`MAILPOST_PATH',, `define(`MAILPOST_PATH', /home/bbs/bin/mailpost)')
ifdef(`MAILPOST_FLAGS',, `define(`MAILPOST_FLAGS', `lsSDFMhPu')')
ifdef(`MAILPOST_ARGS',, `define(`MAILPOST_ARGS', `mailpost')')
POPDIVERT
#################################
### BBS Mailer specification ###
#################################
VERSIONID(`@(#)bbs.m4 8.11 (ijliao) 1/22/1999')
Mbbsmail, P=BBSMAIL_PATH, F=BBSMAIL_FLAGS, U=bbs, S=10, R=20/40,
A=BBSMAIL_ARGS $u
Mmailpost, P=MAILPOST_PATH, F=MAILPOST_FLAGS, U=bbs, S=10, R=20/40,
A=MAILPOST_ARGS $u
==========================[我是bbs.m4的分隔線]=============================
再來修改 m4/proto.m4, 首先找到 Sparse=0 這個部分, 將後面的內容修改如下:
Sparse=0
R$* $: $>Parse0 $1 initial parsing
ifdef(`_MAILER_bbs_',`dnl
Rbbs < @ $=w . > $#mailpost $: bbs mailpost for bbs
Rbbsreg < @ $=w . > $#mailpost $: bbsreg mailpost for bbs
R$+.bbs < @ $=w . > $#bbsmail $: $1 bbs mail gateway',
`dnl')
R<@> $#_LOCAL_ $: <@> special case error msgs
R$* $: $>ParseLocal $1 handle local hacks
R$* $: $>Parse1 $1 final parsing
同樣的檔案再往下找尋 "handle locally delivered names" 並修改後面的內容:
# handle locally delivered names
R$=L $#_LOCAL_ $: @ $1 special local names
ifdef(`_MAILER_bbs_',`dnl
Rbbs $#mailpost $: bbs mailpost for bbs
Rbbsreg $#mailpost $: bbsreg mailpost for bbs
R$+.bbs $#bbsmail $: $1 bbs mail gateway',
`dnl')
R$+ $#_LOCAL_ $: $1 regular local names
黃色就是你要增加的部分, 每一行都三個欄位, 欄位間的空白請用 tab 鍵.
接著去 /etc/mail, 將 freebsd.mc 拷貝為 你的hostname.mc, 比如說我這台
為 lion.ee.ncku.edu.tw, 則我的檔名便是 lion.ee.ncke.edu.tw.mc
修改該檔案, 在最後一行加入
MAILER(bbs)
儲存離開, 在 /etc/mail 目錄裡面執行 make 並重新啟動:
# make install restart-mta
* 方法二: 直接修改 sendmail.cf
找到你的 sendmail.cf 所在, 直接修改:
首先找到 Sparse=0 這一段, 將後方文字修改如下:
Sparse=0
R$* $: $>Parse0 $1 initial parsing
Rbbs < @ $=w . > $#mailpost $: bbs mailpost for bbs
Rbbsreg < @ $=w . > $#mailpost $: bbsreg mailpost for bbs
R$+.bbs < @ $=w . > $#bbsmail $: $1 bbs mail gateway
R<@> $#local $: <@> special case error msgs
R$* $: $>ParseLocal $1 handle local hacks
R$* $: $>Parse1 $1 final parsing
接著往下 100 行左右, 找到 handle locally delivered names:
# handle locally delivered names
R$=L $#local $: @ $1 special local names
Rbbs $#mailpost $: bbs mailpost for bbs
Rbbsreg $#mailpost $: bbsreg mailpost for bbs
R$+.bbs $#bbsmail $: $1 bbs mail gateway
R$+ $#local $: $1 regular local names
最後是檔案的末端, 加入:
Mbbsmail, P=/home/bbs/bin/bbsmail, F=lsSDFMhPu, U=bbs, S=10, R=20/40,
A=bbsmail $u
Mmailpost, P=/home/bbs/bin/mailpost, F=lsSDFMhPu, U=bbs, S=10, R=20/40,
A=mailpost $u
然後重新啟動 sendmail:
# /etc/rc.d/sendmail restart
※ 使用 postfix
假設設定檔案都在 /usr/local/etc/postfix/ 裡面, 而目前所在目錄就在那邊.
首先編輯 main.cf, 加入下面兩行:
transport_maps = hash:/usr/local/etc/postfix/transport
virtual_maps = pcre:/usr/local/etc/postfix/virtual
然後是 master.cf, 加入下面兩行:
bbsmail unix - n n - - pipe flags=FR user=bbs argv=/home/bbs/bin/bbsmail
$mailbox (接上行)
mailpost unix - n n - - pipe flags=FR user=bbs argv=/home/bbs/bin/mailpost
接著編輯 transport:
bbsmail bbsmail:
mailpost mailpost:
以及 virtual, 假設我的 domain name 為 your.domain.name.here
/^(.+)\.bbs@your\.domain\.name\.here$/ $1bbsmail.
/^bbs(reg)?@your\.domain\.name\.here$/ bbs@mailpost.
然後產生 hash 檔案:
# postmap hash:/usr/local/etc/postfix/transport
最後重新載入設定檔:
# postfix reload
這樣子就行了.
同樣注意, Firebird 與 Ptt 只要加入 bbsmail 那部份即可.
--
我的簽名檔只有十個字.
--
^..^ ★ < 豬 頭 紀 公 園 - php.twbbs.org (140.113.208.200) >
-w @@ w-- < bittern.csie.nctu.edu.tw >