Templated/Formatted Emails

Hi Jeff,

Good question. I’m not aware of any built-in ways of doing this directly (others may know a way). Would it be doable for you to use HTML in the body of the email?

anvil.email.send(
  to="customer@example.com",
  from_address="support",
  from_name="MyApp Support",
  subject="Welcome to MyApp",
  html="<h1>Welcome!</h1>"
)

Getting the body of the email to match the formatting on your page exactly seems like a bit of work, but that is the only method I can think of at the moment. Otherwise I suppose you could construct a media object (perhaps a PDF with PyPDF2) and send it along as an attachment.

I hope this helps.