下面跟著筆者一起來了解下dovecot+MySQL如何搭建郵件云服務(wù)器,相信大家看完肯定會(huì)受益匪淺,文字在精不在多,希望dovecot+mysql如何搭建郵件云服務(wù)器這篇短內(nèi)容是你想要的。
創(chuàng)新互聯(lián)公司長期為上千客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為北塔企業(yè)提供專業(yè)的成都做網(wǎng)站、成都網(wǎng)站建設(shè),北塔網(wǎng)站改版等技術(shù)服務(wù)。擁有十多年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。
1.[root@westos-mail ~]# yum install dovecot-mysql.x86_64 -y#dovecot的插件,讓此軟件可以識別mysql###
2.[root@westos-mail ~]# vim /etc/dovecot/conf.d/10-auth.conf #認(rèn)證文件
123 !include auth-sql.conf.ext #同意mysql認(rèn)證
3.cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext #生成dovecot讀取mysql的配置
4.[root@westos-mail ~]# vim /etc/dovecot/dovecot-sql.conf.ext #修改配置
32 driver = mysql #數(shù)據(jù)庫類型
71 connect = host=localhost dbname=email user=postuser password=postuser #登錄(連接查詢)的庫、用戶、密碼
78 default_pass_scheme = PLAIN #默認(rèn)認(rèn)證方式為明文
108 SELECT username, domain, password \ #查詢密碼匹配
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' #查詢郵件內(nèi)容
5.[root@westos-mail ~]# vim /etc/dovecot/conf.d/10-mail.conf
168 first_valid_uid = 666 #郵件文件查詢用戶
175 first_valid_gid = 666
30 mail_location = maildir:/home/vmail/%d/%n #郵件指定位置
6.[root@westos-mail ~]# systemctl restart dovecot.service
測試:
[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
####空殼郵件####
空殼:
別人看見的是這臺“假主機(jī)”,炮灰。
對外顯示與真實(shí)機(jī)相同,別人發(fā)送的郵件表象給它,實(shí)則是它轉(zhuǎn)給真是主機(jī)。
1.[root@mail ~]# vim /etc/postfix/main.cf
76 myhostname = qq-mail.qq.com #主機(jī)名
83 mydomain = qq.com #域名
99 myorigin = westos.com #真實(shí)云服務(wù)器所在的域
116 inet_interfaces = all
119 inet_protocols = all
164 mydestination = #不接受任何郵件
316 relayhost = 172.25.254.113 #轉(zhuǎn)發(fā)到真實(shí)的郵件云服務(wù)器
2.[root@mail ~]# systemctl restart postfix.service
測試:
發(fā)送端:
[root@qq-mail ~]# mail root@westos.com
Subject: wq
521
,
.
EOT
[root@qq-mail ~]# mail
No mail for root
[root@qq-mail ~]# mailq
Mail queue is empty
真實(shí)的郵件云服務(wù)器端:
[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 19/573 "hah"
>N 2 root Wed May 31 05:15 22/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
521
,
& q
Held 2 messages in /var/spool/mail/root
You have mail in /var/spool/mail/root
[root@westos-mail ~]#
看完dovecot+mysql如何搭建郵件云服務(wù)器這篇文章后,很多讀者朋友肯定會(huì)想要了解更多的相關(guān)內(nèi)容,如需獲取更多的行業(yè)信息,可以關(guān)注我們的行業(yè)資訊欄目。