使用阿里云ECS制作IRedMail收发邮件服务器详细过程如下
1、什么是IRedMail?
iRedMail - 免费、开源邮件服务解决方案
以最佳的方式搭建基于 Linux/BSD 和开源软件的邮件服务器。始于 2007 年。
支持 Red Hat Enterprise Linux、CentOS、Debian、Ubuntu、FreeBSD、OpenBSD
只需几分钟,iRedMail 即可为您部署一台完全基于开源软件、功能完善的邮件服务器,而且,免费。
使用的都是开源领域有口皆碑的开源软件,并预设了最佳配置,让您可以“开箱即用”。
2、安装IRedMail
安装文档在这,设置好之后要设置阿里云域名A和MX的解析记录,如下:
值得注意的一点是:阿里云ECS是禁用SMTP发件的25端口的,如果你想使用就要申请了,虽然你能够在ECS的安全规则下打开这个端口,但是阿里云技术文档也说了,实际还是被封的!
所以我这里只当收件功能,发件我没试!
3、配置文件
安装好IRedMail之后,接着你要设置/etc/postfix/main.cf下的主机和域名,如下:
inet_protocols = ipv4
virtual_alias_domains =
myhostname = mail.xfindzp.com
myorigin = mail.xfindzp.com
allow_percent_hack = no
swap_bangpath = no
mydomain = xfindzp.com
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
biff = no
inet_interfaces = all
mynetworks = 0.0.0.0/0
然后再设置ECS的主机名,如下 :
然后重启下ECS即可生效
接着设置打开后台管理系统,添加域:mail.xfindzp.com和用户:[email protected],如下:
查看下mail.xfindzp.com在阿里云ECS服务器上解析情况:
☁ ~ telnet mail.xfindzp.com 110
Trying 47.97.104.97...
Connected to mail.xfindzp.com.
Escape character is '^]'.
+OK Dovecot ready.
user [email protected]
+OK
pass 23456789
+OK Logged in.
list
+OK 3 messages:
1 2781
2 2745
3 2853
4、测试收信
用我自己的qq邮箱发送的时候报下面的错:
如何解决这个问题呢,这个我查看了/var/log/maillog日志和/var/log/dovecot.log日志,发现报错:
Jul 8 15:46:14 mail postfix/smtpd[2272]: NOQUEUE: reject: RCPT from unknown[14.17.44.32]: 450 4.1.8 <[email protected]>: Sender address rejected: Domain not found; from=<[email protected]> to= proto=ESMTP helo=
这个问题值到我提交到阿里云工单上面技术人员才帮我解决问题,如下:
问题原因找到了,原来是var/spool/postfix/etc/resolv.conf文件和/etc/resolv.conf有差异
把后面文件里面的ip替换前面文件里面的ip才搞定,真是个坑,还好解决了,再测试发信试试
# vim /var/spool/postfix/etc/resolv.conf
options timeout:1 attempts:1 rotate
nameserver 10.202.72.116
nameserver 10.202.72.118
替换成:
options timeout:1 attempts:1 rotate
nameserver 100.100.2.138
nameserver 100.100.2.136
# vim /etc/resolv.conf
nameserver 100.100.2.138
nameserver 100.100.2.136
options timeout:2 attempts:3 rotate single-request-reopen
成功
再看看后台,也是收到了!
至此收信功能圆满完成!
总结:
1、一开始我并没有安装IRedMail,而是在ECS上面安装postfix+dovecot+extmail,但是添加域以及收发件都是不成功的,没办法到网上找到了ECS的境像:iRedMail 运行环境镜像使用指南
镜像环境是:CentOS 6.5 64位
这个他已经帮你搭建好了,你只要按照他的说明文档来就好,而且账户和密码什么的已经保存到/alidata/account.log里面了,直接拿来登录就好!
问题:
1、安装过程中遇到好多问题,都无法解决,找了好多人,加了好多群,但是值到我使用IRedMail才看到希望
引用:
1、IRedMail
2、IRedMail安装文档
3、Setup DNS records for your iRedMail server (A, PTR, MX, SPF, DKIM)
4、iRedMail邮件服务的部署
5、iRedMail 运行环境镜像使用指南
6、Postfix邮件发送和接收实验
7、CentOS7下搭建postfix邮箱服务器并实现extmail的web访问
*8、使用Postfix和Dovecot收发电子邮件
9、请求-阿里云搭建邮件服务器
10、基于腾讯云主机CentOS搭建邮件收发服务器
11、查看centos中的用户和用户组
12、[
linux(CentOS)之postfix服务器Dovecot接收邮件](http://blog.51cto.com/hf1208/...
*13、Sendmail邮件服务器报错:-ERR Plaintext authentication disallowed on non-secure (SSL/TLS) connections 解决办法
14、Sender address rejected: Domain not found
15、iRedMail运行环境(Centos 64位 | iRedMail)
*16、nslookup命令详解
17、postfix 邮件服务的安装及详解
[root@mail ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 2636/master
tcp 0 0 127.0.0.1:9998 0.0.0.0:* LISTEN 15771/amavisd (mast
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 2256/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 2256/dovecot
tcp 0 0 127.0.0.1:10031 0.0.0.0:* LISTEN 1582/perl
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1614/httpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 908/sshd
tcp 0 0 0.0.0.0:24 0.0.0.0:* LISTEN 2256/dovecot
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2636/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1614/httpd
tcp 0 0 0.0.0.0:4190 0.0.0.0:* LISTEN 2256/dovecot
tcp 0 0 127.0.0.1:7777 0.0.0.0:* LISTEN 13617/python
tcp 0 0 127.0.0.1:10024 0.0.0.0:* LISTEN 15771/amavisd (mast
tcp 0 0 127.0.0.1:10025 0.0.0.0:* LISTEN 2636/master
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1843/mysqld
history.log
1 ll
2 netstat -anpt
3 mysql -uroot
4 netstat -lnpt
5 vi /etc/sysconfig/network
6 vi /etc/hosts
7 ll
8 netstat -lnpt
9 vim /alidata/account.log
10 vi /etc/postfix/main.cf
11 vim /etc/postfix/main.cf
12 vim /alidata/account.log
13 service postfix restart
14 vim /alidata/account.log
15 ll
16 vim /alidata/account.log
17 cd /var/vmail/vmail1
18 ll
19 cd email.xfindzp.com/
20 ll
21 cd t/
22 ll
23 cd e/
24 ll
25 cd s/
26 ll
27 vim test01-2018.07.06.16.41.59/
28 vim /alidata/account.log
29 mysql -uroot -pV6433FNMKF
30 ll
31 cd test01-2018.07.06.16.41.59/
32 ll
33 cd Maildir/
34 ll
35 cd new/
36 ll
37 cd ../
38 ll
39 cd cur/
40 ll
41 cd ../tmp/
42 ll
43 cd ../
44 ll
45 vim dovecot.index.log
46 vim dovecot.mailbox.log
47 vim /alidata/account.log
48 hostnamectl set-hostname email.xfindzp.com
49 hostname
50 cat /etc/hosts
51 yum install hostnamectl
52 hostnamectl set-hostname email.xfindzp.com
53 vim /etc/sysconfig/network
54 cat /etc/sysconfig/network
55 hostname email.xfindzp.com
56 vim /etc/hosts
57 hostname
58 exit
59 hostname
60 ll
61 cd /var/
62 ll
63 cd mail/
64 ll
65 cd vmail
66 ll
67 systemctl status postfix
68 service profix status
69 service posfix status
70 service postfix status
71 cat /var/log/maillog
72 history
73 vim /etc/postfix/main.cf
74 cat /var/log/maillog
75 netstat -lnpt
76 cat /var/log/maillog
77 vim /etc/postfix/main.cf
78 service postfix restart
79 vim /etc/postfix/main.cf
80 netstat -anpt
81 netstat -lnpt
82 exit
83 ll
84 cat /var/log/maillog
85 hostname -f
86 vim /etc/sysconfig/network
87 vim /etc/hostname
88 vim /etc/hosts
89 hostname -f
90 service postfix restart
91 vim /etc/selinux/config
92 exit
93 netstat -lnpt
94 vim /etc/postfix/main.cf
95 service postfix restart
96 vim /etc/selinux/config
97 cat /var/log/maillog
98 vim /alidata/account.log
99 cat /var/log/maillog
100 cat /etc/resolv.conf
101 vim /etc/hostname
102 hostname -f
103 systemctl iptables status
104 service iptables status
105 vim /etc/postfix/main.cf
106 mail
107 cat /etc/sysconfig/network
108 cat /etc/hosts
109 vim /etc/host
110 vim /etc/hosts
111 cat /etc/hosts
112 cat /var/log/maillog
113 tail /var/log/maillog
114 > /var/log/maillog
115 tail /var/log/maillog
116 vi /etc/dovecot/conf.d/10-auth.conf
117 vim /etc/dovecot/conf.d/10-auth.conf
118 vim /etc/dovecot/conf.d/10-ssl.conf
119 service dovecot restart
120 service postfix restart
121 tail /var/log/maillog
122 > /var/log/maillog
123 tail /var/log/maillog
124 printf "[email protected]" | openssl base64
125 printf "extmail" | openssl base64
126 telnet email.xfindzp.com 25
127 cat /usr/lib/sasl2/smtpd.conf
128 tail /var/log/maillog
129 ping 126mx02.mxmail.netease.com
130 tail /var/log/maillog
131 > /var/log/maillog
132 tail /var/log/maillog
133 vim /etc/postfix/main.cf
134 vim /etc/postfix/mysql/virtual_mailbox_domains.cf
135 > /var/log/maillog
136 tail /var/log/maillog
137 mail
138 > /var/log/maillog
139 netstat -lnpt
140 top
141 netstat -lnpt
142 tail /var/log/maillog
143 exit
144 netstat -lnpt
145 vim /alidata/account.log
146 hostname -f
147 tail /var/log/maillog
148 vim /etc/postfix/main.cf
149 service postfix restart
150 tail /var/log/maillog
151 vim /etc/postfix/main.cf
152 service postfix restart
153 tail /var/log/maillog
154 netstat -lnpt
155 ps -ef | grep 32383
156 netstat -anpt
157 tail /var/log/maillog
158 vim /etc/postfix/main.cf
159 service postfix restart
160 cat /etc/resolv.conf
161 nslookup
162 vim /etc/postfix/main.cf
163 service postfix restart
164 vim /alidata/account.log
165 tail /var/log/maillog
166 telnet email.xfindzp.com
167 telnet email.xfindzp.com 25
168 tail /var/log/maillog
169 > /var/log/maillog
170 tail /var/log/maillog
171 telnet email.xfindzp.com 25
172 tail /var/log/maillog
173 ps -ef | grep smtp
174 netstat -lnpt
175 vim /var/named
176 user list
177 ll
178 cd
179 ll
180 pwd
181 cd /
182 ll
183 cd home/
184 ll
185 cd al
186 cd /alidata/
187 ll
188 cd init/
189 ll
190 vim initPasswd.sh
191 vim /var/www/iredadmin/settings.py
192 su - boss
193 vim /etc/dovecot/conf.d/10-mail.conf
194 tail /var/log/maillog
195 vim /alidata/account.log
196 ll /var/vmail
197 cd /var/vmail/vmail1/
198 ll
199 cd email.xfindzp.com/
200 ll
201 cd t/
202 ll
203 cd e/
204 ll
205 cd s/
206 ll
207 cd test04-2018.07.07.14.19.01/
208 ll
209 cd Maildir/
210 ll
211 cd new/
212 ll
213 vim /etc/postfix/main.cf
214 service postfix restart
215 ll
216 cd ..
217 ll
218 vim dovecot.index.log
219 vim dovecot.mailbox.log
220 ll tmp/
221 ll cur/
222 ll subscriptions
223 vim subscriptions
224 vim /etc/postfix/main.cf
225 telnet email.xfindzp.com
226 telnet email.xfindzp.com 25
227 tail /var/log/maillog
228 netstat -tan | grep -i :110
229 telnet localhost 110
230 tail /var/log/maillog
231 telnet localhost 110
232 netstat -lnpt
233 vim /etc/dovecot/dovecot.conf
234 id test04
235 vim /alidata/account.log
236 cut -d : -f 1 /etc/passwd
237 ll
238 ls -all
239 cat /etc/passwd | grep -v /sbin/nologin | cut -d : -f 1
240 w root
241 useradd boss
242 echo "123456" | passwd --stdin boss
243 cut -d : -f 1 /etc/passwd
244 telnet localhost 110
245 systemctl start dovecot
246 service dovecot restart
247 ps -ef | grep dovecot
248 id vmail
249 telnet localhost 110
250 vim /etc/dovecot/dovecot.conf
251 vim /var/log/dovecot.log
252 > /var/log/dovecot.log
253 cat /var/log/dovecot.log
254 telnet localhost 110
255 cat /var/log/dovecot.log
256 telnet localhost 110
257 cat /var/log/dovecot.log
258 w root
259 cat /etc/passwd
260 telnet localhost 110
261 useradd zw
262 passWd zw
263 passwd ze
264 passwd zw
265 telnet localhost 110
266 cat /etc/passwd
267 cat /var/log/dovecot.log
268 > /var/log/dovecot.log
269 telnet localhost 110
270 cat /var/log/dovecot.log
271 > /var/log/dovecot.log
272 telnet localhost 110
273 cat /var/log/dovecot.log
274 netstat -lntp
275 w test04
276 w root
277 telnet localhost 110
278 vim /etc/dovecot/conf.d/10-auth.conf
279 vim /etc/dovecot/conf.d/10-ssl.conf
280 service dovecot restart
281 vim /etc/dovecot/conf.d/10-mail.conf
282 vim /etc/dovecot/dovecot.conf
283 service dovecot restart
284 mail
285 telnet localhost 110
286 cat /var/log/dovecot.log
287 > /var/log/dovecot.log
288 cat /var/log/dovecot.log
289 ll
290 cd new/
291 ll
292 vim /etc/dovecot/dovecot.conf
293 vim /etc/dovecot/conf.d/10-mail.conf
294 cd ~
295 ll
296 cd /etc/dovecot/conf.d
297 ll
298 vim 10-auth.conf
299 vim 10-mail.conf
300 service dovecot restart
301 vim /etc/dovecot/dovecot.conf
302 vim /etc/dovecot/conf.d/10-mail.conf
303 service dovecot restart
304 cat /var/log/dovecot.log
305 history
306 vim /var/log/maillog
307 whois
308 ping email.xfindzp.com
309 nslookup
310 vim /var/log/maillog
311 vim /var/log/dovecot.log
312 vim /etc/postfix/main.cf
313 service postfix restart
314 vim /etc/postfix/main.cf
315 vim /var/log/maillog
316 hostname -f
317 cat /etc/hosts
318 more /etc/sysconfig/network
319 hostname
320 more /proc/sys/kernel/hostname
321 cd /etc
322 ls
323 vim my.cnf
324 vim networks
325 vim /var/log/maillog
326 cd /etc/dovecot/
327 ll
328 vim dovecot.conf
329 service dovecot restart
330 vim /var/log/maillog
331 > /var/log/maillog
332 vim /var/log/maillog
333 cat /var/log/maillog
334 hostname
335 vim /etc/sysconfig/network
336 hostname
337 vim /etc/hosts
338 hostname
339 more /etc/sysconfig/network
340 more /etc/hosts
341 more /proc/sys/kernel/hostname
342 vim /proc/sys/kernel/hostname
343 exit
344 hostname
345 vim /etc/postfix/main.cf
346 service postfix restart
347 vim /alidata/account.log
348 cd /var/vmail
349 ll
350 cd vmail1/
351 ll
352 netstat -lntp
353 ll
354 cat /var/log/maillog
355 netstatp
356 netstat -anpt
357 service dovecot restart
358 > /var/log/maillog
359 cat /var/log/maillog
360 vim /etc/postfix/main.cf
361 cat /var/log/maillog
362 vim /etc/postfix/main.cf
363 service postfix restart
364 vim /etc/postfix/main.cf
365 cat /var/log/maillog
366 netstat -anpt
367 vim /etc/postfix/main.cf
368 pwd
369 exit
370 ll
371 vim hostnam~
372 ll
373 cd
374 ll
375 cd echo
376 netstat -anpt
377 netstat -lnpt
378 cat /var/log/maillog
379 vim /etc/resolv.con
380 vim /etc/resolv.conf
381 vim /alidata/account.log
382 exit
383 vim /var/spool/postfix/etc/resolv.conf
384 cd /var/spool/postfix/etc
385 ll
386 cp resolv.conf resolv.conf_copy
387 vim resolv.conf_copy
388 vim resolv.conf
389 vim resolv.conf_copy
390 cat /var/log/maillog
391 exit
392 netstat -lnpt
393 vim /etc/postfix/main.cf
394 vim /proc/sys/kernel/hostname
395 cat /proc/sys/kernel/hostname
396 history
397 more /etc/sysconfig/network
398 cat /etc/hosts
399 vim /alidata/account.log
400 history
401 vim /var/log/dovecot.log
402 cat /var/log/maillog
403 history
404 vim /var/spool/postfix/etc/resolv.conf
405 vim /var/spool/postfix/etc/resolv.conf_copy
406 vim /etc/resolv.conf
407 vim /var/spool/postfix/etc/resolv.conf
408 netstat -lnpt
409 history > history.log