电脑技术学习

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

dn001

  cd /usr/ports/lang/php4

  make config

  make install clean

  ⑨安装php4-extensions。根据需要选择模块,保证[MYSQL]、[PCRE]、[SESSION]被选中。

cd /usr/ports/lang/php4-extensions
make config
make install clean

  ⑩安装postfixadmin。安装完成后将网页移动至/usr/www/data/

cd /usr/ports/mail/postfixadmin
make install clean
mv /usr/local/www/postfixadmin /usr/local/www/data/

  ○11安装squirrelmail

  cd /usr/ports/mail/squirrelmail

  make install clean

  至此,所需软件全部安装完毕,下面将依次进行配置。

  2、配置文件

  ①配置sasl

ee /usr/local/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path: /var/run/authdaemond/socket

  ②配置mysql数据库

chmod –R mysql:mysql /var/db/mysql
cd /usr/local/bin/
./mysql_install_db
cd /usr/local/libexec
./mysqld –user=mysql%26amp;
cd /usr/local/www/postfixadmin
mysql –uroot –p < DATABASE_MYSQL.TXT

  ③配置postfix

  使用和apache一样的用户来读取邮件目录,因为apache用户为www,id:80,所以要注意/usr/local/etc/postfix/main.cf中的用户id。

  mkdir –p /usr/local/virtual

  chmod –R www:www /usr/local/virtual

  ee /usr/local/etc/postfix/main.cf

  在最后添加:

#======= BASE ==============
#myhostname =
#mydomain = example.com
home_mailbox = maildir/
#mydestination = $myhostname
#local_recipIEnt_maps =
#======= MYSQL =============
virtual_gid_maps = static:80
virtual_mailbox_base = /usr/local/virtual
virtual_uid_maps = static:80
virtual_minimum_uid = 80
virtual_alias_maps = mysql:/usr/local/etc/postfix/mysql/virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/usr/local/etc/postfix/mysql/virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/usr/local/etc/postfix/mysql/virtual_mailbox_maps.cf
#======= Quota ============
message_size_limit = 5242880
virtual_mailbox_limit_inbox = no
virtual_mailbox_limit_override = yes
virtual_maildir_extended = yes
virtual_create_maildirsize = yes
virtual_mailbox_limit_maps = mysql:/usr/local/etc/postfix/mysql/virtual_mailbox_limit_maps.cf
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

标签: