centos 6.8-x64安装postfix

转自:http://blog.51yip.com/server/1382.html
参考:http://lomu.me/post/SPF-DKIM-DMARC-PTR
参考:http://blog.eqoe.cn/posts/build-perfect-mail-server.html
参考:http://www.appmaildev.com/cn/dkim
参考:http://www.mail-tester.com/
参考:http://www.hostloc.com/thread-385827-1-1.html
yum install postfix -y
yum install cyrus* -y
yum remove sendmail -y

alternatives --config mta
按 Enter 来保存当前选择[+],或键入选择号码:1

alternatives --display mta

vim /etc/postfix/main.cf

myhostname = localhost  //76行,将等号后面的部分改写为本机主机名
mydomain = 51yip.com   //82行,设置域名
myorigin = $mydomain   //97行,把$myhostname改为$mydomain
inet_interfaces = all  //112行,把后面的localhost改成all
mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain //163行,把前面的注释拿掉,并加一下$mydomain
mynetworks = 192.168.0.0/24, 127.0.0.0/8  //263行,设置内网和本地IP
local_recipient_maps =  //209行,把前面的注释拿掉。
smtpd_banner = $myhostname ESMTP unknow //568行,把前面的注释拿掉,然后把$mail_name ($mail_version)改成unknow

//在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的路径

vim /etc/sasl2/smtpd.conf

添加以下内容
log_level: 3     //记录log的模式
saslauthd_path:/var/run/saslauthd/mux     //设置一下smtp寻找cyrus-sasl的路径
chkconfig postfix on
chkconfig saslauthd on
chkconfig cyrus-imapd on
/etc/init.d/postfix start
/etc/init.d/saslauthd start
/etc/init.d/cyrus-imapd start

passwd cyrus  //设置cyrus的密码
testsaslauthd -u cyrus -p '******'   //测试

cyradm -u cyrus localhost --auth plain

cm 1 //创建用户1
sam 1 cyrus all  //赋予cyrus删除用户1的权限
dm 1  //删除用户1

mail -s '看一下' test@test.com  < /etc/imapd.conf

查看日志
tail -f /var/log/maillog
修改hostname
vim /etc/syconfig/network
测速25端口是否连通
yum install traceroute telnet -y
telnet mx2.qq.com 25
traceroute -n -T -p 25 mx2.qq.com
ss-panel魔改版中的设置  //直接用本机搭建的postfix
# smtp
$System_Config['smtp_host'] = '127.0.0.1';  //服务器ip或域名
$System_Config['smtp_username'] = 'cyrus';  //服务器邮件管理账号
$System_Config['smtp_port'] = '25';  //端口
$System_Config['smtp_name'] = 'Nothing';  //发信用户名,可以自定义
$System_Config['smtp_sender'] = 'noreply@test.com';  //发信邮箱,可以自定义
$System_Config['smtp_passsword'] = 'password';  //cyrus的密码
$System_Config['smtp_ssl'] = 'false';
添加端口
http://525042.blog.51cto.com/515042/1329189
问题:postdrop: warning: inet_protocols: configuring for IPv4 support only
服务器没有设置好ipv6,postfix单独启用ipv4即可
vim /etc/postfix/main.cf
inet_protocols = all
改为
inet_protocols = ipv4
a
smtp 1.2.3.4

mx
@ smtp.test.org 10

txt
@ v=spf1 ip4:1.2.3.4 ~all

txt
_dmarc v=DMARC1;p=reject;rua=noreply@test.com

txt
default._domainkey v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb...

此博客中的热门博文

Mingw64添加regex库

永远的蝴蝶 陈启佑

python3 gdb使用教程