系统是FreeBSD 12 64位。
1.pkg install postfix # 安装postfix,替换默认的sendmail
2.vi /etc/rc.conf # 编辑配置文件,禁用sendmail
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
postfix_enable="YES"
3.service sendmail stop # 停掉sendmail
4.newaliases
5.service postfix start # 启动 postfix
6.vi /etc/periodic.conf # 编辑配置文件
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
7.pkg install apache24 # 安装 apache24
8.pkg install p5-CGI.pm # 安装Perl的cgi
9.pkg install openwebmail # 安装 openwebmail

10.vi /usr/local/etc/apache24/httpd.conf # 编辑 apache 的配置文件,启用 mod_cgi.so 模块,添加一个新站点设置,如
<VirtualHost *:80>
DocumentRoot "/usr/local/www/data"
ServerName drs2.anqun.org
ErrorLog "/var/log/dummy-drs2.anqun.org-error_log"
<Directory />
AllowOverride none
Require all granted
</Directory>
<Directory "/usr/local/www/data">
AllowOverride none
Require all granted
</Directory>
ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"
<Directory "/usr/local/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
AddHandler cgi-script .pl
DirectoryIndex index.html openwebmail.pl
</VirtualHost>
11.sysrc apache24_enable="YES" # 启用 apache24 服务
12.service apache24 start # 启动 apache
13.adduser # 添加一个普通用户,加到wheel组中
14.在浏览器里访问cgi-bin目录,如 http://drs2.anqun.org/cgi-bin/openwebmail , 登录

15.首次登录会提示设置基本信息

16.发信正常

17.收信正常

参考: