Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use correct attributes from Email
  • Loading branch information
polsala committed Feb 24, 2025
commit 1f5fb58c89bfc6605d69a07455fccf148fd829ab
18 changes: 16 additions & 2 deletions qreu/sendcontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,26 @@ def sendmail(self, mail):
if isinstance(mail.from_, Address):
from_mail = from_mail.address

# Extraer contenido del cuerpo del email
body_html = mail.body_parts.get("html", None)
body_text = mail.body_parts.get("plain", None)

if body_html:
body_content = body_html
content_type = "HTML"
elif body_text:
body_content = body_text
content_type = "Text"
else:
body_content = "No content"
content_type = "Text"

email_data = {
"message": {
"subject": mail.subject,
"body": {
"contentType": "HTML" if mail.body_html else "Text",
"content": mail.body_html or mail.body_text
"contentType": content_type,
"content": body_content
},
"toRecipients": [{"emailAddress": {"address": addr}} for addr in mail.recipients_addresses],
"from": {"emailAddress": {"address": from_mail}}
Expand Down
Loading