CentOS 7 builds a mail server (postfix+dovecot)

Experimental environment:
CentOS 7 (mail server) ip192.168.80.128, a Windows7 on the same network segment (client test)

1. Configure the host name of the server. The host name of the server must be consistent with the sending domain name
[root@lie ~]# vim /etc/hostname
mail.lie.com
[root@lie ~]# hostname
mail.lie.com

2. Configure the Postfix service program (CentOS 7 comes with Postfix, the previous version is not clear, if you need yum to install it) directly modify the configuration file (6 modified positions)

[root@lie ~]# vim /etc/postfix/main.cf
#Set the host name at about line 76
myhostname = mail.lie.com
#Set the domain name at line 86
mydomain = lie.com
#Define the domain for sending mail in Around line 99
myorigin = $mydomain
#Define the network card listening address (all represents all) Around line 116
inet_interfaces = all
#Define the list of host names or domain names that can receive emails Around line 164
mydestination = $myhostname, $mydomain
#Trusted customers The end is around line 268.
mynetworks = 192.168.80.0/24, 127.0.0.0/8,
so far postfix settings are complete, restart the service and configure boot-up autostart
[root@lie~]# systemctl restart postfix
[root@lie~]# systemctl enable postfix

3. Configure Dovecot service program
#Install dovecot (default installation is ok)
[root@lie~]# yum install dovecot
#Installation completed modify configuration file
[root@lie~]# vim /etc/dovecot/dovecot.conf
#Go to Comment about 24 lines
protocols = imap pop3 lmtp
#Set the network segment address that allows login at about 50 lines
login_trusted_networks = 192.168.80.0/24
#Configure the email format and storage path (remove the 24-line comment)
[root@lie~]# vim / etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
#Restart dovecot service and boot
[root@lie~]# systemctl restart dovecot
[root@ lie~]# systemctl enable dovecot

4. Create a login account for the email system (the account and password of the local system, so you can create a regular account in the local system) [
root@lie~]# useradd test
[root@lie~]# passwdtest
#Create stand for saving Mail directory (if you didn’t create this directory at the beginning, the Windows client configuration account cannot be configured)
[root@lie~]#mkdir -p mail/.imap/INBOX
The setup is now complete! ! !
Install Foxmail on the Windows 7 client and configure the test mailbox account to send and receive emails normally
insert image description here

Guess you like

Origin blog.csdn.net/qq_51235445/article/details/125429006