First, to build the mail server before preparing the following:
Centos 7.2 64-bit
postfix-2.8.12.tar.gz Postfix MTA (mail transfer agent)
dovecot-2.1.8.tar.gz IMAP and POP3 mail servers
Postfixadmin-2.3.5.tar.gz Open source Web mailbox and Domain name account management tool written in PHP
ROUNDCUBEMAIL-0.8.1.TAR.GZ Open source IMAP mail Web client written in PHP
Second, the installation process
1. Installing Postfix
Yum-y install Postfix
#安装完成还需要替换系统自带的sendmail:
RPM-E SendMail
Or
Yum Remove SendMail
#修改MTA (Default message transfer agent)
Alternatives--config MTA # then enter directly.
#检查一下是不是已经设置成功了.
Alternatives--display MTA
The first line can see the state of the MTA. For example: Mat-status is manual.
2. Installing Dovecot
Yum-y Install Dovecot
3. Configure Postfix
Edit/ETC/POSTFIX/MAIN.CF
Vi/etc/postfix/main.cf
Modify the following:
# 75 Lines: Uncomment, set hostname
myhostname = Mail
# 83 Lines: Uncomment, set domain name
MyDomain = qq.com
# 99 Lines: Uncomment
Myorigin = $mydomain
# 116 Rows: Modify
Inet_interfaces = All
# 119 Lines: Recommended IPv4, if IPv6 is supported, all can be
Inet_protocols = IPv4
# 164 Rows: Add
mydestination = $myhostname, localhost. $mydomain, localhost, $mydomain
# 264 lines: Uncomment, specify IP address ranges for intranet and local
Mynetworks = 127.0.0.0/8, 10.0.0.0/24
# 419 lines: Uncomment, mail save directory
Home_mailbox = maildir/
# 571 Rows: Add
Smtpd_banner = $myhostname ESMTP
# Add to Last
# Specify the maximum size of the message is 10M
Message_size_limit = 10485760
# Specify Inbox maximum capacity of 1G
Mailbox_size_limit = 1073741824
# SMTP Authentication
Smtpd_sasl_type = Dovecot
Smtpd_sasl_path = Private/auth
Smtpd_sasl_auth_enable = yes
Smtpd_sasl_security_options = noanonymous
Smtpd_sasl_local_domain = $myhostname
Smtpd_recipient_restrictions = Permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
#配置修改完成, start postfix
Systemctl Restart Postfix.service
4. Configure Dovecot
Modify the following:
[Email protected] ~]# vi/etc/dovecot/dovecot.conf
# 26 Lines: If you do not use IPV6, please change to *
Listen = *
[Email protected] ~]# vi/etc/dovecot/conf.d/10-auth.conf
# 9 Lines: Uncomment and modify
Disable_plaintext_auth = No
# 97 Rows: Add
Auth_mechanisms = Plain Login
[Email protected] ~]# vi/etc/dovecot/conf.d/10-mail.conf
# 30 Lines: Uncomment and add
Mail_location = Maildir:~/maildir
[Email protected] ~]# vi/etc/dovecot/conf.d/10-master.conf
# 88-90 lines: Uncomment and add
# Postfix SMTP Authentication
Unix_listener/var/spool/postfix/private/auth {
mode = 0666
user = Postfix
Group = Postfix
}
[Email protected] ~]# systemctl restart Dovecot.service
Starting Dovecot Imap: [OK]
Test sending messages on the mail server
echo "Hello World" |mail-s ' My name is RAYONG "[email protected]
If sent successfully, the target mailbox will receive the mail and may be in the bin
Since then, the Linux platform Postfix server-side configuration is complete.
Linux platform build postfix mail server