Set up postfix and dovecot simple email servers in CentOS
1. Install postfix and dovecot
Yum install postfix
Yum install dovecot
Ii. postfix email server configuration
Vim/etc/postfix/main. cf
Myhostname = mail.ning.com
Mydomain = ning.com
Myorigin = $ mydomain
Inet_interfaces = all
Inet_protocols = all
Mydestination = $ mydomain
Mynetworks = 0.0.0.0/0
Relay_domains = $ mydestination
Home_mailbox = Maildir/
Service postfix restart
Comment out inet_interfaces = localhost
Iii. Use telnet to test whether the email server is normal
1. Install telnet on the email server
Yum install telnet
2. Connect to the SMTP port of the server
Telnet 192.168.1.22 25
3. Enter the sender
Mail from: <test@cning.com>
Enter
4. Enter the recipient
Rcpt to: contact@ning.com
Enter
5. Write email content
5.1 start to write email content
DATA
Enter
5.2 enter the title
Subject: test message
Enter
5.3 enter the content and end with.
Test body.
If the following information is displayed, the email enters the sending queue.
250 2.0.0 OK: queued as 88D6D32A94
4. Configure dovecot to receive emails
Vim/etc/dovecot. conf
Protocols = imap pop3 lmtp
Listen = *,::
Login_trusted_networks = 0.0.0.0/0
Vim/etc/dovecot/conf. d/10-mail.conf
Mail_location = maildir :~ /Maildir # Set only the mailbox path
Vim/etc/dovecot/conf. d/10-auth.conf
Auth_mechanic ISMs = plain login # allow authentication and login
Disable_plaintext_auth = yes # Allow plaintext Login
Vim/etc/dovecot/conf. d/10-master.conf
Unix_listener auth-userdb {# databases allowed to run
# Mode = 0600
User = postfix
Group = postfix
}
Service dovecot restart
V. Test
Create useradd aaa-p 521521
Mail aaa@ning.com
Acceptance can be tested using foxmail