邮件服务器
Cyrus+postfix
1
2
|
yum install postfix
yum install cyrus
|
postfix 不能和 sendmail 同时使用
服务器版本CentOS 7----1611 内核版本3.10.0-514.el7.x86_64
Centos7与之前的版本不一样的命令systemctl和 防火墙firewall-cmd命令
firewalld与iptables-service无法共存
采用教程参考
http://www.cnblogs.com/apexchu/p/4271264.html
http://blog.csdn.net/clyao_123456/article/details/46693579
配置修改:
1、Postfix配置文件/etc/postfix/main.cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
[root@mailmonitor postfix]
myhostname = localhost //76 行,后边写邮箱主机名即mail.****.***
mydomain = 51yip.com //83 行,设置域名
myorigin = $mydomain //99 行,去掉注释
inet_interfaces = all //113 行,把后面的localhost改成all
mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain //164 行,把前面的注释拿掉,并加一下$mydomain
mynetworks = 192.168.0.0 /16 , 127.0.0.0 /8 //264 行,设置内网和本地IP
local_recipient_maps = //210 行,去掉注释
smtpd_banner = $myhostname ESMTP unknow //573 行,去掉注释
// 在main.cf文件的底部加上以下内容
smtpd_sasl_auth_enable = yes // 使用SMTP认证
broken_sasl_auth_clients = yes // 让不支持RFC2554的smtpclient也可以跟postfix做交互。
smtpd_sasl_local_domain = $myhostname // 指定SMTP认证的本地域名
smtpd_sasl_security_options = noanonymous // 取消匿名登陆方式
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination // 设定邮件中有关收件人部分的限制
smtpd_sasl_security_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination // 设置允许范围 未生效
message_size_limit = 15728640 // 邮件大小
mailbox_transport=lmtp:unix: /var/lib/imap/socket/lmtp // 设置连接cyrus-imapd的路径
|
参考两位的配置中有个参数在实际使用中无法生效 smtpd_sasl_security_restrictions 加上该选项postfix无法正常使用,因此我给注释掉了。
2、cyrus配置更改
Cyrus-sasl配置
1
2
3
|
[root@localhost postfix]
log_level: 3 // 记录log的模式
saslauthd_path: /var/run/saslauthd/mux // 设置一下smtp寻找cyrus-sasl的路径
|
cyrus-imapd配置文件/etc/sysconfig/cyrus-imapd,/etc/cyrus.conf,/etc/imapd.conf。imapd.conf还包含非常多的参数,例如邮件存储目录、管理员账号、连接认证方式等等。
启动命令:
1
2
3
|
systemctl startpostfix
systemctl startsasl-authd
systemctl startcyrus-imapd
|
防火墙需要添加的命令
1
|
firewall-cmd –zone=public --add-port=25 /tcp –permanent // 永久添加25端口
|
or
1
|
firewall-cmd --addservice=smtp –permanent // 直接添加服务
|
firewall-cmd –get-services 可以得到所有存在的服务
firewall-cmd –list-all列出所有信息
防火墙动态更新命令 firewall-cmd–reload
查看端口监听
测试邮件命令
1
|
mail -s ‘title’*****@**mail < /root/test (邮件内容)
|
添加账号

本文转自forsk 51CTO博客,原文链接:http://blog.51cto.com/forsk/1914448,如需转载请自行联系原作者