找一下有沒有sendmail的進程.
#ps -aux | grep sendmail
#killall sendmail
sendmail_enable="yes"#killall sendmail
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)#cp main.cf main.cf.orig
#vi main.cf
mail_owner = postfix
在main.cf里加上或更改以下幾行:mydomain = gogogo.org //你的主機域名
myhostname = gogogo.gogogo.com //你的主機名稱
myorigin = mail.gogogo.org //把外寄的郵件名改为aaa@mail.gogogo.org
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
2) 設定 aliases 的目錄將 aliases 檔轉換為 aliases.db
myhostname = gogogo.gogogo.com //你的主機名稱
myorigin = mail.gogogo.org //把外寄的郵件名改为aaa@mail.gogogo.org
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
# cd /usr/local/etc/postfix # /usr/local/sbin/postalias hash:aliases 或者是 #newaliases
3) 設定 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/postmap hash:access 或者是 #/usr/local/sbin/postmap /usr/local/etc/postfix/access
#/usr/local/sbin/postfix start // 啟動 postfix
#/usr/local/sbin/postfix stop // 停止postfix
#/usr/local/sbin/postfix reload //重新啟動 postfix
4. 測試postfix
#/usr/local/sbin/postfix stop // 停止postfix
#/usr/local/sbin/postfix reload //重新啟動 postfix
#telnet localhost 25
helo localhost
250 gogogo.gogogo.org
mail from: kinux@gogogo.gogogo.org
250 ok
rcpt to:kinuxventure@sinaman.com
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!!helo localhost
250 gogogo.gogogo.org
mail from: kinux@gogogo.gogogo.org
250 ok
rcpt to:kinuxventure@sinaman.com
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.
1. 安裝設定qpopper
#cd /usr/ports/mail/qpopper
#make install clean
安裝完後要設定 /etc/inetd.conf#make install clean
找出一行 :
#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. 84405.1060849605@gogogo.gogogo.org
quit
+ok pop server at gogogo.gogogo.org signing off.
connection closed by foreign host.
1. 安裝openwebmail
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. 84405.1060849605@gogogo.gogogo.org
quit
+ok pop server at gogogo.gogogo.org signing off.
connection closed by foreign host.
#cd /usr/ports/mail/openwebmail
#mak install
全部完成!!!#mak install
http://localhost/cgi-bin/openwebma.../openwebmail.pl
收信啰!!! ^_^!!
參考: book: absolute bsd - the ultimate guide to freebsd chapter 14
url:
http://redhat.ecenter.idv.tw/bbs/showthrea...?threadid=22730
http://www.gocar.idv.tw/teachdata/postfix-sasl.htm
,
文章整理:站长天空 网址:http://www.z6688.com/
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




