1、安装postfix和dovecot
yum -y install postfix dovecot system-switch-mail system-switch-mail-gnome
卸载原有sendmail
yum -y remove sendmail
2、配置
Postfix和Dovecot配置
2.1、配置Postfix
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 192.168.0.0/24, 127.0.0.0/8
relay_domains =
home_mailbox = Maildir/
2.2、配置Dovecot
编辑/etc/dovecot/dovecot.conf
vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
编辑/etc/dovecot/conf.d/10-mail.conf
vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
编辑/etc/dovecot/conf.d/20-pop3.conf
vim /etc/dovecot/conf.d/20-pop3.conf
pop3_uidl_format = %08Xu%08Xv
3. 创建用户和邮箱目录
3.1、创建用户
useradd -s /sbin/nologin heguo
passwd heguo
# 设置123456密码
3.2、创建邮箱目录
mkdir /home/heguo/Maildir
chown heguo:heguo /home/heguo/Maildir
chmod -R 700 /home/heguo/Maildir
4、启动服务
chkconfig --level 345 dovecot on
/etc/init.d/dovecot start
/etc/init.d/postfix start
PS:邮箱已经可以正常收发了、Postfix还没做认证登录、也还没做免进垃圾邮箱的配置。
完成以下两步就可以搭建一个企业级邮件系统