Use compose_email() to create an email object. The message consists of three main content areas: body, header, and footer. You can pass Markdown text to these areas using the md() function. To include images, transform an on-disk file into an HTML string using add_image().
# 1. Prepare content components
date_time <- add_readable_time()
img_file_path <- system.file("img", "pexels-photo-267151.jpeg", package = "blastula")
img_string <- add_image(file = img_file_path)
# 2. Compose the email
email <- compose_email(
body = md(glue::glue(
"Hello,
This is a *great* picture I found when looking
for sun + cloud photos:
{img_string}
")),
footer = md(glue::glue("Email sent on {date_time}."))
)
# 3. Preview the email in the RStudio Viewer
email