[GH-ISSUE #353] [BUG] smtp_proxy_server 在启用“PASSWORDS”环境变量后,无法正常收发邮件 #119

Closed
opened 2026-02-26 20:35:44 +03:00 by kerem · 2 comments
Owner

Originally created by @o2asdv on GitHub (Jul 16, 2024).
Original GitHub issue: https://github.com/dreamhunter2333/cloudflare_temp_email/issues/353

没有加载“PASSWORDS”相关环境变量的代码。代码修改如下,供参考:

--- config.py.bak
+++ config.py
@@ -13,6 +13,7 @@
     proxy_url: str = "http://localhost:8787"
     port: int = 8025
     imap_port: int = 11143
+    basic_password: str = ""
 
     class Config:
         env_file = ".env"

--- imap_server.py.bak
+++ imap_server.py
@@ -16,7 +16,6 @@
 _logger = logging.getLogger(__name__)
 _logger.setLevel(logging.INFO)
 
-
 @implementer(imap4.IMessage)
 class SimpleMessage:
 
@@ -121,9 +120,11 @@
             f"{settings.proxy_url}/api/mails?limit={limit}&offset={start - 1}",
             headers={
                 "Authorization": f"Bearer {self.password}",
+                "x-custom-auth": f"{settings.basic_password}",
                 "Content-Type": "application/json"
             }
         )
+
         if res.status_code != 200:
             _logger.error(
                 "Failed: "
@@ -147,9 +148,11 @@
             f"{settings.proxy_url}/api/sendbox?limit={limit}&offset={start - 1}",
             headers={
                 "Authorization": f"Bearer {self.password}",
+                "x-custom-auth": f"{settings.basic_password}",
                 "Content-Type": "application/json"
             }
         )
+
         if res.status_code != 200:
             _logger.error(
                 "Failed: "
Originally created by @o2asdv on GitHub (Jul 16, 2024). Original GitHub issue: https://github.com/dreamhunter2333/cloudflare_temp_email/issues/353 没有加载“PASSWORDS”相关环境变量的代码。代码修改如下,供参考: ``` --- config.py.bak +++ config.py @@ -13,6 +13,7 @@ proxy_url: str = "http://localhost:8787" port: int = 8025 imap_port: int = 11143 + basic_password: str = "" class Config: env_file = ".env" --- imap_server.py.bak +++ imap_server.py @@ -16,7 +16,6 @@ _logger = logging.getLogger(__name__) _logger.setLevel(logging.INFO) - @implementer(imap4.IMessage) class SimpleMessage: @@ -121,9 +120,11 @@ f"{settings.proxy_url}/api/mails?limit={limit}&offset={start - 1}", headers={ "Authorization": f"Bearer {self.password}", + "x-custom-auth": f"{settings.basic_password}", "Content-Type": "application/json" } ) + if res.status_code != 200: _logger.error( "Failed: " @@ -147,9 +148,11 @@ f"{settings.proxy_url}/api/sendbox?limit={limit}&offset={start - 1}", headers={ "Authorization": f"Bearer {self.password}", + "x-custom-auth": f"{settings.basic_password}", "Content-Type": "application/json" } ) + if res.status_code != 200: _logger.error( "Failed: " ```
kerem closed this issue 2026-02-26 20:35:45 +03:00
Author
Owner

@dreamhunter2333 commented on GitHub (Jul 16, 2024):

感谢反馈

<!-- gh-comment-id:2229973774 --> @dreamhunter2333 commented on GitHub (Jul 16, 2024): 感谢反馈
Author
Owner

@dreamhunter2333 commented on GitHub (Jul 19, 2024):

感谢反馈,一修改到主分支

<!-- gh-comment-id:2239354520 --> @dreamhunter2333 commented on GitHub (Jul 19, 2024): 感谢反馈,一修改到主分支
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cloudflare_temp_email#119
No description provided.