看板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 >