Re: [問題] 關於sendmail的配置
終於爬到文了QQQ
首先 我是用 Postfix 當 Mail Server
/etc/postfix/master.cf
#加入下面這兩行 讓postfix把信轉給bbsmail
bbsmail unix - n n - - pipe
flags=R user=bbs argv=/home/bbs/bin/bbsmail $mailbox
#有用procmail的話 google一下「bbsmail postfix」也有方法喔
#不過我一直失敗就是了...
/etc/postfix/main.cf
#確定有這兩行 沒有的話自己加 讓postfix去參考這兩個檔案
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = pcre:/etc/postfix/virtual
/etc/postfix/transport
#加入這兩行 讓postfix知道 看到 xxx@bbsmail.your.bbs.hostname 要轉給bbs
bbsmail bbsmail:
bbsmail.your.bbs.hostname bbsmail:
/etc/postfix/virtual
#加入這四行 讓postfix知道
#xxx.bbs@your.bbs.hostname 等於 xxx@bbsmail.your.bbs.hostname
/^(.+).bbs@/ $1@bbsmail.
/^(.+).bbs@/ $1@bbsmail.your.bbs.hostname
/^(.+).bbs@your\.bbs\.hostname\$/ $1.bbs@bbsmail.
/^(.+).bbs@your\.bbs\.hostname\$/ $1.bbs@bbsmail.your.bbs.hostname
然後執行
postmap hash:/etc/postfix/transport
postfix reload
以上是收信的部份
寄信的部份 啟動mbbsd時 記得也要啟動outmail(說明沒寫到)
以下是我的方式 (RedHat Linux系列可用)
參考 /etc/init.d/vsftpd 改來的 init scripts
可以用 chkconfig 把它設定成開機啟動的程式之一
也可以用 /etc/init.d/mbbsd stop 的方式控制
/etc/init.d/mbbsd
---------------------------------------------------------------
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mbbsd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Short-Description: Ptt BBS
# Description: PTT Bulletin Board System Daemon
### END INIT INFO
# mbbsd This shell script takes care of starting and stopping
# standalone mbbsd.
#
# chkconfig: - 99 45
# description: PTT BBS
# processname: mbbsd
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
RETVAL=0
prog="mbbsd"
start() {
# Start daemons.
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1
[ -x /home/bbs/bin/mbbsd ] || exit 1
echo -n $"Starting $prog : "
/home/bbs/bin/shmctl init 1>/dev/null 2>&1
/home/bbs/bin/outmail &
/home/bbs/innd/innbbsd &
daemon /home/bbs/bin/mbbsd 23 $i
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
echo
RETVAL=1
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc $prog
killall innbbsd
killall outmail
killall shmctl
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
restart_mbbsd() {
# Restart mbbsd only
echo -n $"Shutting down $prog itself: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
echo -n $"Starting $prog itself: "
daemon /home/bbs/bin/mbbsd 23 $i
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
RETVAL=1
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/$prog ]; then
stop
start
RETVAL=$?
fi
;;
status)
status $prog
RETVAL=$?
;;
restart_mbbsd)
restart_mbbsd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status|restart_mbbsd}"
exit 1
esac
exit $RETVAL
---------------------------------------------------
※ 編輯: sodas2002 來自: 140.116.23.48 (10/28 15:35)
※ 編輯: sodas2002 來自: 140.116.23.48 (10/28 15:36)
※ 編輯: sodas2002 來自: 140.116.23.48 (10/28 15:38)
→
10/28 17:12, , 1F
10/28 17:12, 1F
→
10/28 19:42, , 2F
10/28 19:42, 2F
→
10/28 19:42, , 3F
10/28 19:42, 3F
→
10/28 21:54, , 4F
10/28 21:54, 4F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):