Home >System Tutorial >LINUX >How to install postfix and set up sasl on CentOS6

How to install postfix and set up sasl on CentOS6

王林
王林forward
2024-04-15 14:30:01653browse

How to install postfix and set up sasl on CentOS6

1. CentOS6 has postfix installed by default. If the system does not have postfix, you can use the following command to install it.
[root@mail ~]# yum -y install postfix
2. Configure postfix's main.cf and configure smtp-auth to use dovecot's sasl function.
[root@mail ~]# vi /etc/postfix/main.cf
# 第75行: 去掉注释,并设置主机名。
myhostname = mail.opsky.top
# 第83行: 去掉注释,并设置域名。
mydomain = opsky.top
# 第99行: 去掉注释。
myorigin = $mydomain
# 第116行: 
inet_interfaces = all
# 第119行: 如果只使用ipv4,那么设置如下。
inet_protocols = ipv4
# 第164行: 配置可接收邮件的域名。
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# 第264行: 去掉注释,并设置本地网络号段.
mynetworks = 127.0.0.0/8, 10.0.0.0/24
# 第419行: 去掉注释,采用Maildir格式。
home_mailbox = Maildir/
# 第571行: 
smtpd_banner = $myhostname ESMTP
# 添加如下配置到文件末尾
# 一封邮件大小限制为10M
message_size_limit = 10485760
# 一个邮箱大小限制为1G
mailbox_size_limit = 1073741824
# 配置SMTP-Auth采用dovecot的sasl功能
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
main.cf配置完毕后,启动postfix,并设置自动启动。

[root@mail ~]# /etc/rc.d/init.d/postfix start 
Starting postfix: [  OK  ]
[root@mail ~]# chkconfig postfix on
3. If iptables is enabled, set iptables to open SMTP port 25.
[root@dlp ~]# iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT

The above is the detailed content of How to install postfix and set up sasl on CentOS6. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:linuxprobe.com. If there is any infringement, please contact admin@php.cn delete