在FreeBSD5.1簡單安裝Postfix+Qpopper+Openwebmail

1.安裝之前
找一下有沒有sendmail的進程.

#ps -aux | grep sendmail
#killall sendmail

sendmail_enable="YES"
sendmail_flags="-bd"
sendmail_outbound_enable="NO"
sendmail_submit_enable="NO"
sendmail_msp_queue_enable="NO"

这裏假設你己安裝了apache.

2.安裝Postfix

#cd /usr/ports/mail/postfix #make install clean

在安裝時會要求要不要安裝一些附加的東西, 全部不要, 直接按ok 就可以了.
在安裝過程中,會問你是否安裝帳號,請按 yes 確定.

3. 設置Postfix

  1. 設置main.cf

#cd /usr/local/etc/postfix
#cp main.cf main.cf.orig
#vi main.cf

首先查一下mail_owner是不是屬postfix擁有.(預設是postfix)

mail_owner = postfix

在main.cf里加上或更改以下幾行:

mydomain = gogogo.org //你的主機域名
myhostname = gogogo.gogogo.com //你的主機名稱
myorigin = mail.gogogo.org //把外寄的郵件名改为[email protected]
alias_maps = hash:/usr/local/etc/postfix/aliases //設定 aliases 的目錄
mynetworks_style = host //只相信自己一台主機
mydestination = $myhostname, localhost. $mydomain, freefall. $mydomain mail3. $mydomain //收信主機的名
relaydomain = $mydestination //允許relay的主机
mailbox_size_limit = 102400000 //設定郵箱大小 100M
disable_vrfy_command = yes // 將vrfy 功能關掉
smtpd_recipient_limit = 100 // 限定每一封信可寄給幾個人,如本例為 100

  1. 設定 aliases 的目錄將 aliases 檔轉換為 aliases.db

cd /usr/local/etc/postfix # /usr/local/sbin/postalias hash:aliases 或者是 #newaliases

  1. 設定 access 檔利用 access 檔來做存取限制
    在 access 中的設定格式如下:
    設定對象 <設定方式>
    其中設定對象可用主機名稱、主機 ip、網域、或郵件地址..
    <設定方式> 主要有 REJECT、OK
    如以下的設定

1.2.3.4 OK // 主机的ip gogogo.gogogo.org OK //主机名

用 postmap 將 access 轉換成 access.db

cd /usr/local/etc/postfix

/usr/local/sbin/postmap hash:access 或者是 #/usr/local/sbin/postmap /usr/local/etc/postfix/access

3. 執行程式

#/usr/local/sbin/postfix start // 啟動 postfix
#/usr/local/sbin/postfix stop // 停止postfix
#/usr/local/sbin/postfix reload //重新啟動 postfix

4. 測試Postfix

#telnet localhost 25
HELO localhost
250 gogogo.gogogo.org
MAIL FROM: [email protected]
250 Ok
RCPT TO:[email protected]
250 Ok
DATA
354 End data with .
This is a short test of the SMTP email system.
.
250 Ok: queued as F341A379
QUIT
221 Bye
Connection closed by foreign host.

搞定Postfix!!

1. 安裝設定Qpopper

#cd /usr/ports/mail/qpopper
#make install clean

安裝完後要設定 /etc/inetd.conf
找出一行 :

#pop3 stream tcp nowait root /usr/local/libexec/popper popper

更改成

pop3 stream tcp nowait root /usr/local/libexec/qpopper qpopper -s

如inetd未運行

#/usr/sbin/inetd &

或者inetd己經是在運行

#kill –HUP (inetd 的pid)

測試Qpopper

#telnet localhost 110
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Qpopper (version 4.0.5) at gogogo.gogogo.org starting. [email protected]
QUIT
+OK Pop server at gogogo.gogogo.org signing off.
Connection closed by foreign host.

1. 安裝OpenWebMail

#cd /usr/ports/mail/openwebmail
#mak install

全部完成!!!

http://localhost/cgi-bin/openwebma.../openwebmail.pl
收信啰!!! ^_^!!

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus