Spaces:
Sleeping
Sleeping
Commit
·
c8801b5
1
Parent(s):
e382003
set the email content-transfer-encoding to 8bit to avoid mangled text, added the building name to the email subject line
Browse files
dam_helper/email_manager/email_manager.py
CHANGED
@@ -13,9 +13,10 @@ class EmailManager:
|
|
13 |
def create_email(self, answers: dict[Questions, str], pdf_form, filename) -> EmailMessage:
|
14 |
msg = EmailMessage()
|
15 |
msg["Subject"] = (f"Minor work permit for unit {answers[Questions.UNIT_APT_NUMBER]} in "
|
16 |
-
f"{answers[Questions.COMMUNITY]}")
|
17 |
msg["From"] = answers[Questions.YOUR_EMAIL]
|
18 |
msg["To"] = "[email protected]"
|
19 |
-
|
|
|
20 |
msg.add_attachment(pdf_form, maintype="application", subtype="pdf", filename=filename)
|
21 |
return msg
|
|
|
13 |
def create_email(self, answers: dict[Questions, str], pdf_form, filename) -> EmailMessage:
|
14 |
msg = EmailMessage()
|
15 |
msg["Subject"] = (f"Minor work permit for unit {answers[Questions.UNIT_APT_NUMBER]} in "
|
16 |
+
f"{answers[Questions.BUILDING]}, {answers[Questions.COMMUNITY]}")
|
17 |
msg["From"] = answers[Questions.YOUR_EMAIL]
|
18 |
msg["To"] = "[email protected]"
|
19 |
+
message = self.repository.send_prompt(self.pm.compose_email(answers), True)["content"]
|
20 |
+
msg.set_content(message, cte="8bit")
|
21 |
msg.add_attachment(pdf_form, maintype="application", subtype="pdf", filename=filename)
|
22 |
return msg
|