调试
This commit is contained in:
@@ -43,8 +43,8 @@ class MailStore:
|
|||||||
logging.info(f"开始保存邮件: 发件人={sender}, 收件人={recipients}")
|
logging.info(f"开始保存邮件: 发件人={sender}, 收件人={recipients}")
|
||||||
logging.debug(f"原始邮件数据: {raw_data}")
|
logging.debug(f"原始邮件数据: {raw_data}")
|
||||||
if recipients is None:
|
if recipients is None:
|
||||||
logging.warning("收件人列表为None,将使用空列表")
|
logging.error("收件人列表为None,无法保存邮件")
|
||||||
recipients_list = []
|
return False, "收件人列表为None"
|
||||||
elif isinstance(recipients, list):
|
elif isinstance(recipients, list):
|
||||||
recipients_list = recipients # 如果是列表,直接使用
|
recipients_list = recipients # 如果是列表,直接使用
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -44,8 +44,11 @@ class EmailHandler(Message):
|
|||||||
|
|
||||||
# 检查收件人列表是否有效
|
# 检查收件人列表是否有效
|
||||||
if not envelope.rcpt_tos:
|
if not envelope.rcpt_tos:
|
||||||
logging.warning("收到邮件但没有有效收件人,将拒绝")
|
logging.error("收件人列表无效,无法保存邮件")
|
||||||
return '550 无效的收件人'
|
return '550 收件人列表无效'
|
||||||
|
elif not isinstance(envelope.rcpt_tos, (list, str)):
|
||||||
|
logging.error("收件人列表格式不正确,无法保存邮件")
|
||||||
|
return '550 收件人列表格式不正确'
|
||||||
|
|
||||||
# 保存原始邮件数据
|
# 保存原始邮件数据
|
||||||
raw_data = envelope.content.decode('utf-8', errors='replace')
|
raw_data = envelope.content.decode('utf-8', errors='replace')
|
||||||
|
|||||||
Reference in New Issue
Block a user