{"id":19317680,"url":"https://github.com/queeniecplusplus/nginx_mail","last_synced_at":"2026-05-13T13:53:11.060Z","repository":{"id":104588366,"uuid":"298153107","full_name":"QueenieCplusplus/Nginx_Mail","owner":"QueenieCplusplus","description":"Mail Server","archived":false,"fork":false,"pushed_at":"2020-09-24T03:50:46.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-06T04:24:49.712Z","etag":null,"topics":["imap","imap-protocol","imap-server","imap4","imapsync","mail-tech","mailbox","mailserver","pop3-client","pop3-protocol","pop3-server","smtp","smtp-client","smtp-mail","smtp-server"],"latest_commit_sha":null,"homepage":"https://github.com/QueenieCplusplus/QuickGoThru/blob/master/README.md#nginx--k8s-in-2020","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QueenieCplusplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-24T02:54:24.000Z","updated_at":"2022-02-17T15:57:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4112daf-ba0e-4a49-9b6c-6c95526c9f16","html_url":"https://github.com/QueenieCplusplus/Nginx_Mail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FNginx_Mail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FNginx_Mail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FNginx_Mail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QueenieCplusplus%2FNginx_Mail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QueenieCplusplus","download_url":"https://codeload.github.com/QueenieCplusplus/Nginx_Mail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240420940,"owners_count":19798501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imap","imap-protocol","imap-server","imap4","imapsync","mail-tech","mailbox","mailserver","pop3-client","pop3-protocol","pop3-server","smtp","smtp-client","smtp-mail","smtp-server"],"created_at":"2024-11-10T01:15:52.193Z","updated_at":"2026-05-13T13:53:06.025Z","avatar_url":"https://github.com/QueenieCplusplus.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nginx_Mail\nMail Server\n\n# 前導\n\n郵件服務，又稱為『電子郵件』，是網路上應用範圍很顧的軟體。郵件服務屬於『非同步』通訊，成本低、操作簡單。並且能在郵件中傳遞超連結、html文字、影像、視訊、音訊等 MIME-TYPE 多元網路媒體型態的內文。\n\n此服務有 4 種軟體套件可以實現其實例，並能支援 ssl 的安全傳輸設定：\n\n* Mailbox, 使用者代理\n\n  如 mail.google.com、mail.yahoo.com\n  使用者看到的 GUI 畫面都是使用者代理用戶端。\n\n* IMAP(Sync)\n\n  使用者下載郵件後，伺服器中的郵件不會被刪除，倘若使用者對郵件進行操作，則會同步狀態至伺服器上，所以伺服器和用戶端本機的郵件狀態保持一制性。\n\n* POP3(Offline)\n\n   使用者下載郵件後，伺服器中的郵件會被刪除，另外此協定為郵件服務的第一個離線 offline 協定。\n   \n* SMTP(Mail Server)\n\n   使用者需要帳號密碼方才能登入，且此協定能幫助避免受到垃圾郵件侵擾。\n\n# Mail Server Instance\n\n      mail{\n\n          server_name mail.pattysapplab.name; #(C)\n\n          # http認證的位址\n          auth_http mail.postfix.tw:80/auth.php; #(F)\n          imap_capabilities IMAP4rev1 ...;\n\n          pop3_auth ...;\n          pop3_capabilities ...;\n\n          smtp_auth ...;\n          smtp_capabilties ...;\n\n          xclient off;\n\n\n      }\n\n      # 針對三台虛擬機的郵件協定設定\n\n      server{\n\n          listen 143;\n          protocol imap; #(D)\n\n\n      }\n\n      server{\n\n          listen 110;\n          protocol pop3;\n          proxy_pass_error_message on;\n\n      }\n\n\n      server{\n\n          listen 25;\n          protocol smtp;\n\n      }\n\n# Auth\n\n            ?php\n\n             if(isset($_SERVER[\"HTTP_AUTH_USER\"]) || !isset($_SERVER[\"HTTP_AUTH_PASS\"])){\n\n                fail();\n\n             } \n\n             # 設定後端伺服器的 port\n\n             $name = $_SERVER[\"HTTP_AUTH_USER\"];\n             $pass = $_SERVER[\"HTTP_AUTH_PASS\"];\n             $protocol = $_SERVER[\"HTTP_AUTH_PROTOCOL\"];\n             $backend_port = 88;#(B)\n\n             if($protocol = \"imap\"){\n                $backend_port = 143;\n             }\n\n             if($protocol = \"smtp\"){\n                $backend_port = 25;\n             }\n\n             if($username = \"kate@mail.pattyappier.name\"){\n                $server_ip = \"192.168.1.8\"; #(A)\n             } else {\n                 faile();\n             }\n\n             function fail(){\n\n                header(\"\");\n                exit;\n\n             }\n\n            ?\u003e\n\n# 郵件服務的基本指令\n\n(A) 郵件伺服器的 ip 位址\n\n    作用於 OSI L3\n\n(B) 郵件伺服器的服務通訊號\n\n    作用於 OSI L4\n\n\n(C) 虛擬主機的域名\n    \n    由虛擬伺服器區塊組成。\n    \n(D) 服務協定\n\n    包含 POP3、SMTP、IMAP。\n    該指令僅能於虛擬伺服器主機區塊中設定。\n    \n(E) so_keepalive\n\n    設定後端代理伺服器啟用 TCP keepalive 模式處理郵件伺服器轉發的用戶端連結。\n    該指令僅能於虛擬伺服器主機區塊中設定。\n\n(F) auth_http [URL]\n\n    設定代理伺服器提供郵件服務時用於 http 認證的伺服器位址。\n    如上範例為 uth_http mail.postfix.tw:80/auth.php;\n    該指令僅能於虛擬伺服器主機區塊中設定。\n    \n(G) auth_http_header X-Auth-Key \"secret-string\";  \n          auth_http_timeout [time];\n\n    如 (F) 認證伺服器發出請求時，代理伺服器在請求的標頭增加指定的標頭域，轉發予使用者端。\n    而逾時的設定預設為 60 m (\u003c75s)，是指代理伺服器向 http 認證伺服器發出認證請求後，等待認證伺服器回應的時間。 \n\n(H) proxy_buffer 4k|8k\n\n    該指令用於設定後端代理伺服器群組之情況，設定伺服器代理快取大小，即平台記憶體分頁大小。\n    該指令僅能於虛擬伺服器主機區塊中設定。\n\n(I) proxy_pass_error_message on\n\n    該指令用於設定後端代理伺服器群組情況，用於設定是否將後端伺服器上郵件服務認證過程中產生的錯誤訊息亦轉發予使用者端。\n    其中，POP3 協定下，此指令應該關閉為 off，否則即便 http 伺服器認證成功，代理伺服器的 POP3 服務認為是認證錯誤。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueeniecplusplus%2Fnginx_mail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqueeniecplusplus%2Fnginx_mail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueeniecplusplus%2Fnginx_mail/lists"}