最近一直在测试 postfix ,发现postfix + dovecot 配置简单不烦琐,dovecot 是后起之秀,下面就来操作,我是如何搭建的。
type master;
file "/etc/bind/ludy.com";
};
$ORIGIN ludy.com.
@ IN SOA ludy.com. root.ludy.com. (
2009072901 ;
68400 ;
86400 ;
3600000; ;
36000 ) ;
IN NS ns.ludy.com.
IN MX 10 .
www IN A 192.168.6.121
mail IN A 192.168.6.121
ns IN A 192.168.6.121
shell $> /etc/init.d/bind9 restart
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 58
Server version: 5.0.67-0ubuntu6 (Ubuntu)
Query OK, 1 row affected (0.00 sec)
mysql> quit
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'postfixadmin';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'root';
$CONF['database_password'] = 'yourpassword';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';
##### 修改测试机器 DNS 为 192.168.6.121 这步我就略过了。####


config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
################################################################################
myhostname =
mydomain = ludy.com
myorigin = $mydomain
mydestination =
mynetworks = 127.0.0.0/8
inet_interfaces = all
home_mailbox = Maildir/
############################################################################
virtual_alias_maps = mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:33
virtual_mailbox_base = /var/vmail ###虚拟用户目录
virtual_mailbox_domains = mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 33 ### 给 apache 权限。
virtual_transport = virtual
virtual_uid_maps = static:33
#################################################################################
message_size_limit = 52428800
mailbox_size_limit = 209715200
virtual_mailbox_limit = 209715200
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_overquota_bounce = yes
#################################################################################
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot ###定义安装方式 dovecot
smtpd_sasl_path = private/auth-client ##### 路径要与 dovecot 一样,一会要讲到
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unknown_sender_domain,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unauth_destination
password = yourpassword
dbname = postfix
table = alias
select_field = goto
where_field = address
shell $> vim mysql_virtual_domains_maps.cf
password = yourpassword
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
shell $> vim mysql_virtual_mailbox_maps.cf
password = yourpassword
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
shell $> vim mysql_virtual_mailbox_limit_maps.cf
password = yourpassword
hosts = localhost
dbname = postfix
table = mailbox
select_field = quota
where_field = username
args = /etc/dovecot/dovecot-sql.conf
}
userdb passwd {
}
args = /etc/dovecot/dovecot-sql.conf
}
socket listen {
client {
path = /var/spool/postfix/private/auth-client ###这里对应 postfix smtpd_sasl_path
mode = 0660
user = postfix
group = postfix
}
}
}
dict {
}
password_query = SELECT password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, 33 AS uid, 33 AS gid FROM mailbox WHERE username = '%u'
shell $> /etc/init.d/dovecot restart







本文出自 “linuxer” 博客,http://deidara.blog.51cto.com/400447/189989
















