Fix IMAP provider imports - use Message instead of email.message.Message to avoid conflict with Email model

This commit is contained in:
Brett Fox 2025-10-21 11:44:03 +11:00
parent b49dad969b
commit 16bc6f0a12

View File

@ -6,7 +6,8 @@ STUB STATUS: Requires IMAP server credentials
- When credentials missing: Provider will fail gracefully
"""
import logging
import email
from email import message_from_bytes
from email.message import Message
from typing import List, Dict, Optional, Any
from datetime import datetime
from email.utils import parsedate_to_datetime
@ -138,7 +139,7 @@ class IMAPProvider(BaseProvider):
logger.error(f"IMAP FETCH ERROR: {e}")
return emails
def _parse_message(self, msg: email.message.Message, msg_id: int) -> Optional[Email]:
def _parse_message(self, msg: Message, msg_id: int) -> Optional[Email]:
"""Parse email.message.Message into Email object."""
try:
subject = msg.get('subject', 'No Subject')