agentic email invite html
This commit is contained in:
parent
42cd937f0a
commit
65bb73f30b
6 changed files with 273 additions and 32 deletions
|
|
@ -19,12 +19,15 @@ def build_message(
|
|||
subject: str,
|
||||
body_text: str,
|
||||
body_html: str | None,
|
||||
reply_to: str | None = None,
|
||||
) -> EmailMessage:
|
||||
message = EmailMessage(policy=SMTP_POLICY)
|
||||
message["From"] = sender
|
||||
message["To"] = ", ".join(recipients)
|
||||
if cc:
|
||||
message["Cc"] = ", ".join(cc)
|
||||
if reply_to:
|
||||
message["Reply-To"] = reply_to
|
||||
message["Subject"] = subject
|
||||
message["Date"] = email.utils.formatdate(localtime=True)
|
||||
message["Message-ID"] = email.utils.make_msgid(domain=sender.split("@")[-1])
|
||||
|
|
@ -90,6 +93,7 @@ async def deliver_email(
|
|||
body_text: str,
|
||||
body_html: str | None,
|
||||
domain: MailDomain,
|
||||
reply_to: str | None = None,
|
||||
) -> None:
|
||||
message = build_message(
|
||||
sender=sender,
|
||||
|
|
@ -98,6 +102,7 @@ async def deliver_email(
|
|||
subject=subject,
|
||||
body_text=body_text,
|
||||
body_html=body_html,
|
||||
reply_to=reply_to,
|
||||
)
|
||||
signed = sign_message(message, domain)
|
||||
await send_via_smtp(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue