Skip to content

Commit

Permalink
set EmailMessage policy as SMTP
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Apr 5, 2024
1 parent 8a9931c commit 7f4f49f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from datetime import datetime
from email.message import EmailMessage
from email import policy
from xml.etree.ElementTree import Element, ElementTree, SubElement
from plone import api
from plone.protect.interfaces import IDisableCSRFProtection
Expand Down Expand Up @@ -42,6 +43,7 @@ def __init__(self, context, data):


class SubmitPost(Service):

def __init__(self, context, request):
super(SubmitPost, self).__init__(context, request)

Expand Down Expand Up @@ -296,7 +298,7 @@ def send_data(self):
.getData()
.strip()
)
msg = EmailMessage()
msg = EmailMessage(policy=policy.SMTP)
msg.set_content(text_message)
msg.add_alternative(message, subtype="html")
msg["Subject"] = subject
Expand Down Expand Up @@ -328,7 +330,7 @@ def send_data(self):
if acknowledgement_message and "acknowledgement" in self.block.get("send", []):
acknowledgement_address = self.get_acknowledgement_field_value()
if acknowledgement_address:
acknowledgement_mail = EmailMessage()
acknowledgement_mail = EmailMessage(policy=policy.SMTP)
acknowledgement_mail["Subject"] = subject
acknowledgement_mail["From"] = mfrom
acknowledgement_mail["To"] = acknowledgement_address
Expand Down

0 comments on commit 7f4f49f

Please sign in to comment.