Skip to content

Commit

Permalink
Adding template.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEBest committed May 21, 2024
1 parent 0da5ebf commit 28f8bee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dhrn-functions/packages/dhrn/sendmail/__main__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import os
import mailtrap as mt
from jinja2 import Template

def main(args):
MAILTRAP_API_TOKEN = os.environ.get("MAILTRAP_API_TOKEN")

with open("template.html") as f:
template = Template(f.read())

mail = mt.Mail(
sender=mt.Address(email="[email protected]", name="Mailtrap Test"),
to=[mt.Address(email="[email protected]")],
subject="New submission from the DHRN Screener",
text="Congrats for sending test email with Mailtrap!",
text="Please enable HTML to view this message",
html=template.render(data=args),
category="Integration Test",
)
client = mt.MailtrapClient(token=MAILTRAP_API_TOKEN)
Expand Down

0 comments on commit 28f8bee

Please sign in to comment.