使用Postfix构建基于FreeBSD的邮件系统( 二 )


virtual_mailbox_limit = 52428800
#======== SASL ================
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated permit_auth_destination reject
#smtpd_sasl_local_domain = $mydomain
smtpd_client_restrictions = permit_sasl_authenticated
几个配置文件:
cd /usr/local/etc/postfix/
mkdir mysql
cd mysql
1、ee virtual_alias_maps.cf
user = postfix
passWord = postfix
hosts = localhost
dbname = postfix
table = alias
select_fIEld = goto
where_field = address
2、ee virtual_domains_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = domain
select_field = description
where_field = domain
3、ee virtual_mailbox_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
4、ee virtual_mailbox_limit_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = quota
where_field = username
④配置courier-authdaemond
cd /usr/local/etc/rc.d
./courier-authdaemond.sh start
chmod o x /var/run/authdaemond
cd /usr/local/etc/authlib
ee authdaemonrc
修改authmodulelist和authmodulelistorig
authmodulelist="authmysql"
authmodulelistorig="authmysql"
添加
version="authaemond.mysql"
courier-imap
ee authmysqlrc
DEFAULT_DOMAIN example.com
MYSQL_CRYPT_PWFIELD password
MYSQL_DATABASE postfix
MYSQL_GID_FIELD '80'
MYSQL_HOME_FIELD '/usr/local/virtual'
MYSQL_LOGIN_FIELD username
MYSQL_MAILDIR_FIELD maildir
MYSQL_NAME_FIELD name
MYSQL_OPT 0
MYSQL_PASSWORD postfix
#MYSQL_PORT 0
#MYSQL_QUOTA_FIELD quota
MYSQL_SERVER localhost
MYSQL_UID_FIELD '80'
MYSQL_USERNAME postfix
MYSQL_USER_TABLE mailbox
这里用户也修改为80 , 注意中间不是空格 , 是TAB键 , 在Unix系统中 , 很多都是用TAB键的 。也请特别注意其中的引号 。
⑤配置amavisd
cd /usr/local/etc/postfix
ee master.cf
在文件最后添加
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipIEnt_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_check
ee main.cf
在文件最后添加
#============AMVISD=============
content_filter=smtp-amavis:[127.0.0.1]:10024
⑥配置clamav
ee /usr/local/etc/clamd.conf
取消下列选项前的#号注释
ScanOLE2
ScanMail
ScanHTML
ScanArchive
ScanRAR
⑦配置启动项
ee /etc/rc.conf
添加下列条目
sendmail_enable="NONE"
postfix_enable="YES"
apache22_enable="YES"
mysql_enable="YES"
courIEr_authdaemond_enable="YES"
courier_imap_imapd_enable="YES"

推荐阅读