I would like to use blastula
to send a set of multiple emails based on the result of an RStudio Connect report. I have been following the instructions from this blog post and I am able to get the report to send a single email based on one row of a data frame data_frame
using code like this:
render_connect_email(input = "email_test.Rmd",
render_options = list(params = list(member = data_frame$member_id[i]))) %>%
attach_connect_email(subject = "Email test")
I would like to be able to loop through data_frame
and send one email for each row, like so:
for (i in 1:nrow(data_frame)) {
render_connect_email(input = "email_test.Rmd",
render_options = list(params = list(member = data_frame[i]))) %>%
attach_connect_email(subject = "Email test")
}
When I publish this, however, I only receive an email based on the value of the last row in the data frame, i.e. i = nrow(data_frame)
. Knitting provides me a rendered version of all of the emails, but RStudio Connect only sends the last one. Is there a way to send multiple emails via Connect, or can it only send one email per report?