How to build a mail cloud server by dovecot+mysql
Let's follow the author to learn how to build an email cloud server in dovecot+mysql. I believe you will benefit a lot after reading it. There are not many words in it. I hope this short article on how to build an email cloud server in dovecot+mysql is what you want.
1. [root@westos-mail ~] # yum install dovecot-mysql.x86_64-y#dovecot plugin, so that this software can recognize mysql###
2. [root@westos-mail ~] # vim / etc/dovecot/conf.d/10-auth.conf # authentication file
123! include auth-sql.conf.ext # agrees to mysql certification
3.cp / usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext / etc/dovecot/dovecot-sql.conf.ext # generate dovecot read mysql configuration
4. [root@westos-mail ~] # vim / etc/dovecot/dovecot-sql.conf.ext # modify configuration
32 driver = mysql # database type
71 connect = host=localhost dbname=email user=postuser password=postuser # Library, user, password for login (connection query)
78 default_pass_scheme = PLAIN # the default authentication method is plaintext
108 SELECT username, domain, password\ # query password match
109 FROM emailuser WHERE username ='% u 'AND domain ='% d'
125 user_query = SELECT maildir, 666 AS uid, 666 AS gid FROM emailuser WHERE username ='% u'# query email content
5. [root@westos-mail ~] # vim / etc/dovecot/conf.d/10-mail.conf
168 first_valid_uid = 666 # Mail file query user
175 first_valid_gid = 666
30 mail_location = maildir:/home/vmail/%d/%n # email specified location
6. [root@westos-mail ~] # systemctl restart dovecot.service
Test:
[root@westos-mail] # telnet 172.25.254.113 110
Trying 172.25.254.113...
Connected to 172.25.254.113.
Escape character is'^]'.
+ OK [XCLIENT] Dovecot ready.
User lee@lee.com
+ OK
Pass lee
+ OK Logged in.
Quit
+ OK Logging out.
Connection closed by foreign host
# Shell mail #
Empty shell:
What others see is this "fake mainframe", cannon fodder.
The external display is the same as the real machine, and the message sent by others appears to be sent to it, but it is actually transferred to the real host.
1. [root@mail ~] # vim / etc/postfix/main.cf
76 myhostname = qq-mail.qq.com # hostname
83 mydomain = qq.com # domain name
99 myorigin = westos.com # the domain where the real CVM resides
116 inet_interfaces = all
119 inet_protocols = all
164By mydestination = # No mail is accepted
316 relayhost = 172.25.254.113 # forward to a real mail cloud server
2. [root@mail ~] # systemctl restart postfix.service
Test:
Sender:
[root@qq-mail ~] # mail root@westos.com
Subject: wq
five hundred and twenty one
.
EOT
[root@qq-mail ~] # mail
No mail for root
[root@qq-mail ~] # mailq
Mail queue is empty
Real email CVM:
[root@westos-mail ~] # mail
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/spool/mail/root": 2 messages 1 new
1 westos@westos.com Mon May 22 05:52 19amp 573 "hah"
> N 2 root Wed May 31 05:15 22 amp 724 "wq"
& 2
Message 2:
From root@westos.com Wed May 31 05:15:45 2017
Return-Path:
X-Original-To: root@westos.com
Delivered-To: root@westos.com
Date: Wed, 31 May 2017 05:15:45-0400
To: root@westos.com
Subject: wq
User-Agent: Heirloom mailx 12.5 7-5-10
Content-Type: text/plain; charset=us-ascii
From: root@westos.com (root)
Status: R
five hundred and twenty one
& Q
Held 2 messages in / var/spool/mail/root
You have mail in / var/spool/mail/root
[root@westos-mail ~] #
After reading this article on how to build an email cloud server in dovecot+mysql, many readers will want to know more about it. For more industry information, you can follow our industry information section.