R Markdown documents can make their own determination about email sending.
This is described here: https://docs.rstudio.com/connect/user/r-markdown.html#r-markdown-email-suppress-scheduled
Let's start with an Rmd that is configured to send email after its scheduled execution. Adjust your Rmd to have code like:
if (the_moon_is_not_full) {
rmarkdown::output_metadata$set(rsc_email_suppress_scheduled = FALSE)
}
This indicates that the default "email!" behavior is being overridden; email will be suppressed.
You can flip this and start by assuming that mail is not sent. Still start by configuring email-after-scheduling in the UI. Change your Rmd to have:
---
title: "Report Title"
rmd_output_metadata:
rsc_email_suppress_scheduled: false
---
```{r}
if (the_moon_is_full) {
rmarkdown::output_metadata$set(rsc_email_suppress_scheduled = TRUE)
}
```