This function is used to customize emails sent by RStudio Connect in conjunction with publishing an R Markdown document. It associates a custom email message with the main R Markdown document, which Connect can send to selected recipients. The main input is a rendered email message, which can be produced by either the render_email() or render_connect_email() function.

attach_connect_email(
  email = NULL,
  subject = NULL,
  attachments = NULL,
  attach_output = FALSE,
  text = NULL,
  preview = TRUE
)

Arguments

email

A rendered email message. Normally, we'd want to use an associated .Rmd file with the blastula::blastula_email R Markdown output format in render_connect_email() call (where its input is the email .Rmd file).

subject

An option to specify the the email subject while attaching the email object.

attachments

A vector of attachments for the Connect email. These files can be any of those deployed when publishing to RStudio Connect, and, any generated files (via R Markdown rendering).

attach_output

Should the rendered output of the main R Markdown document be included as an email attachment? By default, this is FALSE. If TRUE the main R Markdown document will be attached first (before any files specified in attachments) and the filename will be preserved.

text

Instead of using a rendered email document through the email option, we can use plain text here. However, if any email object is supplied then input to text is ignored.

preview

Should the email message display it's own preview window? If TRUE (the default), the rendered email message will be shown in the default browser.

Details

Since this function needs to be invoked within an R Markdown document, the chunk option echo=FALSE is useful here (so that viewers of the rendered document don't have to unnecessarily read code related to email inclusion). While the output is invisible, any errors related to rendering will be visible to the author.