{"id":94,"date":"2011-09-04T14:48:53","date_gmt":"2011-09-04T06:48:53","guid":{"rendered":"http:\/\/www.kiccleaf.com\/?p=94"},"modified":"2011-09-17T11:59:52","modified_gmt":"2011-09-17T03:59:52","slug":"centos-5-6-x86_64%e7%b3%bb%e7%bb%9f%e4%b8%8bpostfix%e9%82%ae%e4%bb%b6%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae%e3%80%90pop3smtp%e3%80%91","status":"publish","type":"post","link":"http:\/\/www.kiccleaf.com\/?p=94","title":{"rendered":"CentOS 5.6 X86_64\u7cfb\u7edf\u4e0bPostfix\u90ae\u4ef6\u7cfb\u7edf\u914d\u7f6e\u3010pop3,smtp\u3011"},"content":{"rendered":"<p>\u786c\u4ef6\u73af\u5883\uff1a<br \/>\n\u670d\u52a1\u5668\u578b\u53f7\uff1aIBM X336<br \/>\nCPU\u578b\u53f7\uff1a Intel(R) Xeon(TM) CPU 3.80GHz *2\u9897<br \/>\n\u5185\u5b58\u578b\u53f7\uff1a 2G*4\u6839<br \/>\n\u786c\u76d8\u578b\u53f7\uff1aSCSI 73G*2\u5757<\/p>\n<p>\u8f6f\u4ef6\u914d\u7f6e\uff1a<br \/>\n\u7cfb\u7edf\uff1aCentOS5.6 x86_64<br \/>\n\u8f6f\u4ef6\uff1aNginx1.0.4+PHP5.3.6(FPM-FCGI)+Mysql5.5.3<\/p>\n<p>Linux\u7cfb\u7edf\u6700\u5c0f\u5b89\u88c5\uff0c\u5728\u6b64\u5c31\u4e0d\u591a\u8bf4\u4e86\u3002\u6b64\u673a\u5668\u4e3b\u8981\u529f\u80fd\u662f\u5bf9\u5916\u8fdb\u884c\u56fe\u7247\u8bbf\u95ee\uff0c\u7531\u4e8e\u516c\u53f8\u9700\u8981\u90ae\u4ef6\u7cfb\u7edf\u8fdb\u884c\u90ae\u4ef6\u53d1\u9001\u548c\u63a5\u6536\uff0c\u8003\u8651Qmail\u914d\u7f6e\u592a\u590d\u6742\uff0csendmail\u914d\u7f6e\u4e5f\u9ebb\u70e6\u6240\u4ee5\u5c31\u9009\u62e9postfix\u4f5c\u4e3a\u90ae\u4ef6\u5904\u7406\u7cfb\u7edf\u3002<\/p>\n<p>1.PostFix\u5b89\u88c5\u914d\u7f6e<br \/>\n2.dovecot\u5b89\u88c5\u914d\u7f6e<br \/>\n3.\u9632\u706b\u5899\u914d\u7f6e<br \/>\n4.\u6d4b\u8bd5\u90ae\u4ef6\u53d1\u9001<\/p>\n<p><span style=\"color: #0000ff;\">1.PostFix\u5b89\u88c5\u914d\u7f6e<\/span><br \/>\n\u7b2c\u4e00\u6b65\uff1a\u9996\u5148\u8fdb\u884c\u5b89\u88c5postfix<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nyum -y install postfix\r\n<\/pre>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u914d\u7f6emain.cf\u6587\u4ef6<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# vim \/etc\/postfix\/main.cf\r\nmyhostname = mail.kiccleaf.com\r\nmydomain = kiccleaf.com\r\nmyorigin=$mydomain\r\ninet_interfaces = all\r\nmydestination = $myhostname, localhost.$mydomain, localhost,$mydomain\r\nrelay_domains = $mydestination\r\nmynetworks = 192.168.1.0\/28, 127.0.0.0\/8,60.191.49.228\/24 #\u586b\u5199\u81ea\u5df1\u7684\u516c\u7f51ip\r\nhome_mailbox = Maildir\/\r\n#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)\u3000 \u2190 \u627e\u5230\u8fd9\u4e00\u884c\uff0c\u63a5\u6b64\u884c\u6dfb\u52a0\u5982\u4e0b\u884c\uff1a\r\nsmtpd_banner = $myhostname ESMTP unknow \u2190 \u6dfb\u52a0\u8fd9\u4e00\u884c\uff0c\u4e0d\u663e\u793aSMTP\u670d\u52a1\u5668\u7684\u76f8\u5173\u4fe1\u606f\r\n\r\n#Add end\r\nsmtpd_sasl_auth_enable = yes\r\nsmtpd_sasl_local_domain = $myhostname\r\nsmtpd_sasl_security_options = noanonymous\r\nsmtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination\r\nmessage_size_limit = 15728640\r\n<\/pre>\n<p>\u7b2c\u4e09\u6b65\uff1a\u914d\u7f6esmtpd.conf<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# vim \/usr\/lib64\/sasl2\/smtpd.conf\r\n\r\npwcheck_method: saslauthd\r\n\u6539\u6210\r\npwcheck_method: auxprop\r\n<\/pre>\n<p>\u7b2c\u56db\u6b65\uff1a\u914d\u7f6epostfix\u968f\u7cfb\u7edf\u542f\u52a8<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# chkconfig saslauthd on\r\n&#x5B;root@kiccleaf ~]# chkconfig --list saslauthd\r\nsaslauthd      \t0:off\t1:off\t2:on\t3:on\t4:on\t5:on\t6:off\r\n\r\n&#x5B;root@kiccleaf ~]# chkconfig postfix on\r\n&#x5B;root@kiccleaf ~]# chkconfig --list postfix\r\npostfix        \t0:off\t1:off\t2:on\t3:on\t4:on\t5:on\t6:off\r\n<\/pre>\n<p>\u7b2c\u4e94\u6b65\uff1a\u542f\u52a8postfix\u670d\u52a1<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# \/etc\/rc.d\/init.d\/saslauthd start\r\nStarting saslauthd:                                        &#x5B;  OK  ]\r\n\r\n&#x5B;root@kiccleaf ~]# \/etc\/rc.d\/init.d\/postfix start\r\nStarting postfix:                                          &#x5B;  OK  ]\r\n<\/pre>\n<p>\u7b2c\u516d\u6b65\uff1a\u5bf9postfix\u8fdb\u884c\u6d4b\u8bd5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntelnet localhost 25\r\nTrying 127.0.0.1...\r\nConnected to localhost.localdomain (127.0.0.1).\r\nEscape character is '^]'.\r\n220 kiccleaf.com ESMTP unknow\r\nehlo localhost\r\n250-kiccleaf.com\r\n250-PIPELINING\r\n250-SIZE 15728640\r\n250-VRFY\r\n250-ETRN\r\n250-AUTH PLAIN LOGIN\r\n250-ENHANCEDSTATUSCODES\r\n250-8BITMIME\r\n250 DSN\r\nquit\r\n221 2.0.0 Bye\r\nConnection closed by foreign host.\r\n<\/pre>\n<p>\u7b2c\u4e03\u6b65\uff1a\u6dfb\u52a0\u914d\u7f6e\uff0c\u7528\u6237\u548c\u5bc6\u7801<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n &#x5B;root@kiccleaf ~]# mkdir \/data\/Maildir\r\n &#x5B;root@kiccleaf ~]# chmod 700 \/data\/Maildir\r\n &#x5B;root@kiccleaf ~]# mkdir \/home\/leaf\/Maildir\r\n &#x5B;root@kiccleaf ~]# chmod 700 \/home\/leaf\/Maildir\r\n &#x5B;root@kiccleaf ~]# chown leaf. \/home\/leaf\/Maildir\r\n &#x5B;root@kiccleaf ~]# saslpasswd2 -u mail.kiccleaf.com -c leaf\u00a0 #\u6dfb\u52a0\u5e10\u53f7leaf\r\n Password:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #\u8f93\u5165\u5bc6\u7801\r\n Again (for verification):\u00a0\u00a0\u00a0 #\u8f93\u5165\u91cd\u590d\u5bc6\u7801\r\n &#x5B;root@kiccleaf ~]# chgrp postfix \/etc\/sasldb2\r\n &#x5B;root@kiccleaf ~]# chmod 640 \/etc\/sasldb2\r\n &#x5B;root@kiccleaf ~]# alternatives --config mta\r\n\r\nThere are 2 programs which provide 'mta'.\r\n\r\nSelection Command\r\n -----------------------------------------------\r\n *+ 1 \/usr\/sbin\/sendmail.sendmail\r\n 2 \/usr\/sbin\/sendmail.postfix\r\n\r\nEnter to keep the current selection&#x5B;+], or type selection number: 2\u00a0\u00a0\u00a0\u00a0\u00a0 #\u9009\u62e9postfix\u4f5c\u4e3a\u90ae\u4ef6\u670d\u52a1\r\n <\/pre>\n<p><span style=\"color: #0000ff;\">2.\u63a5\u4e0b\u53bb\u5b89\u88c5pop3\u63a5\u6536\u670d\u52a1dovecot<\/span><br \/>\n\u7b2c\u4e00\u6b65\uff1adovecot\u670d\u52a1\u5b89\u88c5<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nyum -y install dovecot\r\n<\/pre>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u7f16\u8f91dovecot.conf\u6587\u4ef6<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\u627e\u5230#protocols = imap imaps pop3 pop3s\u884c\u6dfb\u52a0\u6216\u662f\u4fee\u6539\uff1a\r\nprotocols = imap pop3\r\n\u8001\u7248\u672cCentOS5.5\u7248\u672c\u662f\u4ee5default_mail_env\u4f5c\u4e3a\u914d\u7f6e\r\nmail_location = maildir:~\/Maildir\r\n<\/pre>\n<p>\u7b2c\u4e09\u6b65\uff1a\u914d\u7f6edovecot\u968f\u7cfb\u7edf\u542f\u52a8<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# chkconfig dovecot on\r\n&#x5B;root@kiccleaf ~]# chkconfig --list dovecot\r\ndovecot        \t0:off\t1:off\t2:on\t3:on\t4:on\t5:on\t6:off\r\n<\/pre>\n<p>\u7b2c\u56db\u6b65\uff1a\u542f\u52a8dovecot\u670d\u52a1<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# \/etc\/rc.d\/init.d\/dovecot start\r\nStarting Dovecot Imap:                                     &#x5B;  OK  ]\r\n<\/pre>\n<p>\u7b2c\u4e94\u6b65\uff1a\u5bf9dovecot\u8fdb\u884c\u6d4b\u8bd5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntelnet localhost 110\r\nTrying 127.0.0.1...\r\nConnected to localhost.localdomain (127.0.0.1).\r\nEscape character is '^]'.\r\n+OK Dovecot ready.\r\nquit\r\n+OK Logging out\r\nConnection closed by foreign host.\r\n<\/pre>\n<p><span style=\"color: #0000ff;\">3.\u9632\u706b\u5899\u914d\u7f6e<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@kiccleaf ~]# vim \/etc\/sysconfig\/iptables\r\n#\u6dfb\u52a0\u4ee5\u4e0b\u4e09\u4e2a\u7aef\u53e325,110,143\r\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT\r\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j ACCEPT\r\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 143 -j ACCEPT\r\n\r\n#\u91cd\u542f\u9632\u706b\u5899\r\n&#x5B;root@kiccleaf ~]# service iptables restart\r\nFlushing firewall rules:                                   &#x5B;  OK  ]\r\nSetting chains to policy ACCEPT: filter                    &#x5B;  OK  ]\r\nUnloading iptables modules:                                &#x5B;  OK  ]\r\nApplying iptables firewall rules:                          &#x5B;  OK  ]\r\nLoading additional iptables modules: ip_conntrack_netbios_n&#x5B;  OK  ]\r\n#\u67e5\u770b\u76d1\u542c\u7aef\u53e3\u5217\u8868\r\n&#x5B;root@kiccleaf ~]# netstat -an\r\nActive Internet connections (servers and established)\r\nProto Recv-Q Send-Q Local Address               Foreign Address             State\r\ntcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN\r\ntcp        0      0 0.0.0.0:2188                0.0.0.0:*                   LISTEN\r\ntcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN\r\ntcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN\r\ntcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN\r\ntcp        0      0 0.0.0.0:58008               0.0.0.0:*                   LISTEN\r\ntcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN\r\ntcp        0      0 192.168.1.9:22           192.168.1.22:2850           ESTABLISHED\r\n<\/pre>\n<p><span style=\"color: #0000ff;\">4.\u6d4b\u8bd5\u90ae\u4ef6\u53d1\u9001<\/span><br \/>\n\u4e3a\u4e86\u65b9\u4fbfFoxmail\u4f5c\u4e3a\u5ba2\u6237\u7aef\u8fdb\u884c\u914d\u7f6e\uff0c\u586b\u5199ip\u4e3apop3\uff0csmtp\uff0c\u586b\u5199\u5e10\u53f7\u540d\u79f0\u53ca\u5bc6\u7801\uff0c\u8fdb\u884c\u53d1\u9001\u6d4b\u8bd5\uff0c\u5728\u6b64\u7528php\u7f16\u5199\u7b80\u8981\u7684\u53d1\u9001\u4ee3\u7801\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n$to      = '53045936@qq.com';\r\n$subject = 'the subject test';\r\n$message = 'hello\uff01\u6d4b\u8bd5\u7528\u4f8b\uff01';\r\n$headers = 'From: leaf@kiccleaf.com' . &quot;\\r\\n&quot; .\r\n'Reply-To:  leaf@kiccleaf.com' . &quot;\\r\\n&quot; .\r\n'X-Mailer: PHP\/' . phpversion();\r\n\r\nmail($to, $subject, $message, $headers);\r\n?&gt;\r\n<\/pre>\n<p>\u81f3\u6b64\u90ae\u4ef6\u7cfb\u7edf\u7684\u53d1\u9001\u548c\u63a5\u6536\u90fd\u5df2\u7ecf\u914d\u7f6e\u5b8c\u6210<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u786c\u4ef6\u73af\u5883\uff1a \u670d\u52a1\u5668\u578b\u53f7\uff1aIBM X336 CPU\u578b&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/www.kiccleaf.com\/?p=94\">Continue reading<span class=\"screen-reader-text\">CentOS 5.6 X86_64\u7cfb\u7edf\u4e0bPostfix\u90ae\u4ef6\u7cfb\u7edf\u914d\u7f6e\u3010pop3,smtp\u3011<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":3,"footnotes":""},"categories":[4],"tags":[11,15,14,12],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-linux-","tag-iptables","tag-postfix","tag-14","tag-12","entry"],"views":14321,"_links":{"self":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=94"}],"version-history":[{"count":0,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}