You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
email: conditional recipients in rendered email metadata #14023
We have recently added support for multiple emails rendered from a single document. This next step will allow any/all emails to have conditional recipients.
I am flexible on the format of accepted quarto input, here is a draft of how it might look:
---title: Email Test Documentauthor: Charles Teagueformat: email---
The report content. Anything that is here is not part of the email message.
::: {.email}
::: {.subject}
The subject line.
:::
```{python}import datetime# Get today's datetoday = datetime.date.today()if today.weekday() < 5: recipients = ["test1@test.com", "test2@test.com", "test3@test.com"]else: recipients = ["test4@test.com", "test5@test.com", "test6@test.com"]```
:::{.recipients}
`{python} recipients`
:::
::: {.email-text}
An optional text-only version of the email message..
:::
The HTML email content. Here you can add code cells, produce images, and write accompanying text.
:::
Any additional report content not part of the email message.
After discussion with @jonkeane, it would also make sense to be able to pass recipients in the following ways (the first in both in both R and Python).
Edit: This approach (::: {.recipients, values=recipients}) isn't possible because the attribute is preserved as values="recipients" in the HTML, so it contains the literal string "recipients", not the evaluated Python variable value.
Activity
juleswg23 commentedon Feb 19, 2026
After discussion with @jonkeane, it would also make sense to be able to pass recipients in the following ways (the first in both in both
RandPython).Edit: This approach (::: {.recipients, values=recipients}) isn't possible because the attribute is preserved as
values="recipients"in the HTML, so it contains the literal string"recipients", not the evaluated Python variable value.