Skip to content

Instantly share code, notes, and snippets.

@carlosveliz
Created October 2, 2024 22:27
Show Gist options
  • Save carlosveliz/09b3b0fa34e5be1dfad7766bc28a0f4b to your computer and use it in GitHub Desktop.
Save carlosveliz/09b3b0fa34e5be1dfad7766bc28a0f4b to your computer and use it in GitHub Desktop.
if 'Subject' in raw_message:
subject, encoding = decode_header(raw_message['Subject'])[0]
if isinstance(subject, bytes):
subject = subject.decode(encoding if encoding else 'utf-8', errors='replace')
message.Subject = subject
else:
message.Subject = "No se reconoce el asunto"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment