2014-07-13 20:17:24
来 源
中存储网
Postfix
缘起:帮中学母校的一个非官方学生组织搭建邮件服务器系统:centos5选型:sendmail相对原始,zimbra套件太重型,最后选了相对灵活且轻量级的postfix+dovecot安装过程没什么好说的,yum和自行编译没有绝对的差异配置:postfix ma

缘起:帮中学母校的一个非官方学生组织搭建邮件服务器

系统:centos5

选型:sendmail相对原始,zimbra套件太重型,最后选了相对灵活且轻量级的postfix+dovecot

安装过程没什么好说的,yum和自行编译没有绝对的差异

配置:

postfix main.cf:

和一般网络找到的配置基本一致

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = localhost, mail.example.com, example.com
local_recipient_maps =
unknown_local_recipient_reject_code = 550
mynetworks_style = host
mynetworks = 127.0.0.0/8
relay_domains = $mydomain
mailbox_commmand = /usr/libexec/dovecot/deliver
mailbox_size_limit = 512000000
virtual_transport = dovecot
local_transport = dovecot
smtpd_sasl_type = dovecot
smtpd_sasl_path = /var/spool/postfix/private/auth-client
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unknown_sender_domain,
    reject_non_fqdn_sender,
    reject_non_fqdn_recipient,
    reject_unknown_recipient_domain,
    reject_unauth_pipelining,
    reject_unauth_destination,
    permit
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
alias =
smtpd_sender_login_maps =
        mysql:/etc/postfix/mysql_virtual_sender_maps.cf
virtual_mailbox_base = /home/dovemail
debug_peer_level = 3
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
home_mailbox = Maildir/
dovecot dovecot:
为了允许非安全连接
disable_plaintext_auth = no

为了允许所有人访问

login_trusted_networks = 0.0.0.0
disable_plaintext_auth = no
login_trusted_networks = 0.0.0.0
log_path = /var/log/dovecot.log
listen = *
info_log_path = /var/log/dovecot-info.log
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:~/Maildir
mbox_write_locks = fcntl
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
service auth {
unix_listener /var/spool/postfix/private/auth-client {
group = postfix
mode = 0660
user = postfix
}
user = root
}
service auth {
unix_listener auth-userdb {
mode = 0660 # socket access mode
user = dovecot # set uid to nobody
group = dovemail # set gid to nobody
}
}
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
userdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}

dovecot dovecot-sql.conf:

driver = mysql
connect = host=localhost dbname=postfix user=postfix password=*********
default_pass_scheme = MD5
password_query = SELECT password, maildir as userdb_home FROM mailbox WHERE username = '%u'
user_query = select maildir as home,000000 as uid ,000000 as gid from mailbox where username='%u' And active='1'


extmail配置的时候没什么特别的,但是要注意用脚本导入邮箱用户名单时,最好用extman附带的maildirmake.pl生成目录结构。


最好把postfix和dovecot都安装成服务。

chkconfig --list postfix|dovecot

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。