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
  1. yum install postfix -y
  2. yum install cyrus* -y
  3. yum remove sendmail -y
  4.  
  5. alternatives --config mta
  6. Enter 来保存当前选择[+],或键入选择号码:1
  7.  
  8. alternatives --display mta
  9.  
  10. vim /etc/postfix/main.cf
  11.  
  12. myhostname = localhost //76行,将等号后面的部分改写为本机主机名
  13. mydomain = 51yip.com //82行,设置域名
  14. myorigin = $mydomain //97行,把$myhostname改为$mydomain
  15. inet_interfaces = all //112行,把后面的localhost改成all
  16. mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain //163行,把前面的注释拿掉,并加一下$mydomain
  17. mynetworks = 192.168.0.0/24, 127.0.0.0/8 //263行,设置内网和本地IP
  18. local_recipient_maps = //209行,把前面的注释拿掉。
  19. smtpd_banner = $myhostname ESMTP unknow //568行,把前面的注释拿掉,然后把$mail_name ($mail_version)改成unknow
  20.  
  21. //在main.cf文件的底部加上以下内容
  22. smtpd_sasl_auth_enable = yes //使用SMTP认证
  23. broken_sasl_auth_clients = yes //让不支持RFC2554的smtpclient也可以跟postfix做交互。
  24. smtpd_sasl_local_domain = $myhostname // 指定SMTP认证的本地域名
  25. smtpd_sasl_security_options = noanonymous //取消匿名登陆方式
  26. smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination //设定邮件中有关收件人部分的限制
  27. smtpd_sasl_security_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination //设置允许范围
  28. message_size_limit = 15728640 //邮件大小
  29. mailbox_transport=lmtp:unix:/var/lib/imap/socket/lmtp //设置连接cyrus-imapd的路径
  30.  
  31. vim /etc/sasl2/smtpd.conf
  32.  
  33. 添加以下内容
  34. log_level: 3 //记录log的模式
  35. saslauthd_path:/var/run/saslauthd/mux //设置一下smtp寻找cyrus-sasl的路径
  36. chkconfig postfix on
  37. chkconfig saslauthd on
  38. chkconfig cyrus-imapd on
  39. /etc/init.d/postfix start
  40. /etc/init.d/saslauthd start
  41. /etc/init.d/cyrus-imapd start
  42.  
  43. passwd cyrus //设置cyrus的密码
  44. testsaslauthd -u cyrus -p '******' //测试
  45.  
  46. cyradm -u cyrus localhost --auth plain
  47.  
  48. cm 1 //创建用户1
  49. sam 1 cyrus all //赋予cyrus删除用户1的权限
  50. dm 1 //删除用户1
  51.  
  52. mail -s '看一下' test@test.com < /etc/imapd.conf
  53.  
  54. 查看日志
  55. tail -f /var/log/maillog
  56. 修改hostname
  57. vim /etc/syconfig/network
  58. 测速25端口是否连通
  59. yum install traceroute telnet -y
  60. telnet mx2.qq.com 25
  61. traceroute -n -T -p 25 mx2.qq.com
  62. ss-panel魔改版中的设置 //直接用本机搭建的postfix
  63. # smtp
  64. $System_Config['smtp_host'] = '127.0.0.1'; //服务器ip或域名
  65. $System_Config['smtp_username'] = 'cyrus'; //服务器邮件管理账号
  66. $System_Config['smtp_port'] = '25'; //端口
  67. $System_Config['smtp_name'] = 'Nothing'; //发信用户名,可以自定义
  68. $System_Config['smtp_sender'] = 'noreply@test.com'; //发信邮箱,可以自定义
  69. $System_Config['smtp_passsword'] = 'password'; //cyrus的密码
  70. $System_Config['smtp_ssl'] = 'false';
  1. 添加端口
  1. http://525042.blog.51cto.com/515042/1329189
  1. 问题:postdrop: warning: inet_protocols: configuring for IPv4 support only
  2. 服务器没有设置好ipv6postfix单独启用ipv4即可
  3. vim /etc/postfix/main.cf
  4. inet_protocols = all
  5. 改为
  6. inet_protocols = ipv4
  1. a
  2. smtp 1.2.3.4
  3.  
  4. mx
  5. @ smtp.test.org 10
  6.  
  7. txt
  8. @ v=spf1 ip4:1.2.3.4 ~all
  9.  
  10. txt
  11. _dmarc v=DMARC1;p=reject;rua=noreply@test.com
  12.  
  13. txt
  14. default._domainkey v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb...

此博客中的热门博文

Mingw64添加regex库

python3 gdb使用教程