The blastula package makes it easy to produce and send HTML email from R. The message can have three content areas (the body, the header, and the footer) and we can insert Markdown text, block-based components, and even HTML fragments. The underlying HTML/CSS is meant to display properly across a wide range of email clients and webmail services. The resulting email message is responsive so it’ll look great on both large displays and mobile devices.
When you compose an email, you can use objects from the global workspace and work them into the message content. Let’s create a nicely formatted date/time string (
date_time) with the
add_readable_time() function, and, transform an image on disk to an HTML string object (
Now we use the
compose_email() function to compose the email. There are three main arguments here:
footer. You can supply Markdown text to any of these content areas to get rendered HTML.
After creating the email message, we can look at it to ensure that the formatting is as expected. Simply call the object itself and it will be displayed in the Viewer.
We can store SMTP email credentials in a file using the
create_smtp_creds_file() function. This will create a hidden credentials file in the working directory. We can also set SMTP access credentials in the system-wide key-value store through the
The blastula package can be installed from CRAN with
You can install the in-development version of blastula from GitHub using the devtools package.
If you encounter a bug, have usage questions, or want to share ideas to make this package better, feel free to file an issue.
Please note that the blastula project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.