feat: IMAP 支持 SSL/STARTTLS 配置
This commit is contained in:
@@ -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