Attachments and in-line graphics would be GREAT. I've managed to string together a bunch of tables produced by the tableHTML package and send them with:
html_msg <- mime() %>%
to(gmail_to_list) %>%
from(my_address) %>%
subject(paste("activity as of", week_end)) %>%
html_body(paste(
"<h2>Enrollment and staffing statistics as of", week_end, "</h2><br>",
if (nrow(starting_soon) == 0) {
"<h3>There are no classes that are starting up at this point.</h3><br><br>"
} else {
paste("<h3>These classes start between ", as.Date(as.POSIXct(today() - 7)) ,
" and ", as.Date(as.POSIXct(today() + 14)) , ":</h3><br>",
starting_soon_table, "<br><br>")
}, # etc., etc.
my_footer
) )
draft_id <- create_draft(html_msg)
send_draft(draft_id)
It would be wonderful to have a bullet-proof, scheduled way to generate emails with a complex mix of elements.