feat: IMAP 支持 SSL/STARTTLS 配置

This commit is contained in:
earthjasonlin committed 2026-07-02 22:18:51 +08:00 Verified
1 parent 05135ee0cc
commit d7daddf491
3 files changed
+10 -1

No files matched your search

+6 -1
View File
@@ -74,7 +74,12 @@ def _select_mailbox(conn, mailbox: str = "INBOX"):
def _login_and_prepare(account: EmailAccount):
logger.info("连接 %s:%d", account.imap_server, account.imap_port)
conn = imaplib.IMAP4_SSL(account.imap_server, account.imap_port)
if account.use_ssl:
conn = imaplib.IMAP4_SSL(account.imap_server, account.imap_port)
else:
conn = imaplib.IMAP4(account.imap_server, account.imap_port)
if account.use_starttls:
conn.starttls()
conn.login(account.username, account.password)
logger.info("登录成功: %s", account.username)
if _check_provider(account.username, _PROVIDERS_NEED_ID):
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.