This commit is contained in:
huangzhenpc
2025-02-26 14:40:33 +08:00
parent f32e5ae861
commit 746a19705e
2 changed files with 7 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ class MailStore:
async def save_email(self, message, sender, recipients, raw_data=None):
"""保存邮件到数据库和文件系统"""
logging.info(f"开始保存邮件: 发件人={sender}, 收件人={recipients}")
logging.debug(f"原始邮件数据: {raw_data}")
if recipients is None:
logging.warning("收件人列表为None将使用空列表")
recipients_list = []
@@ -49,6 +50,11 @@ class MailStore:
body_html = ""
attachments = []
# 检查message是否有效
if message is None:
logging.error("邮件内容无效,无法保存邮件")
return False, "邮件内容无效"
# 提取邮件主题
if hasattr(message, 'subject') and message.subject:
email_subject = message.subject

View File

@@ -40,6 +40,7 @@ class EmailHandler(Message):
"""处理邮件数据"""
try:
logging.info(f"收到邮件: 发件人={envelope.mail_from}, 收件人={envelope.rcpt_tos}")
logging.debug(f"邮件内容: {envelope.content.decode('utf-8', errors='replace')}")
# 检查收件人列表是否有效
if not envelope.rcpt_tos: