{"id":13736521,"url":"https://github.com/rstudio/blastula","last_synced_at":"2025-12-12T00:54:20.645Z","repository":{"id":41950164,"uuid":"100158101","full_name":"rstudio/blastula","owner":"rstudio","description":"Easily send great-looking HTML email messages from R","archived":false,"fork":false,"pushed_at":"2025-04-03T12:59:03.000Z","size":46827,"stargazers_count":552,"open_issues_count":106,"forks_count":85,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-10T07:43:50.909Z","etag":null,"topics":["easy-to-use","email","html","markdown","r","responsive-email","smtp"],"latest_commit_sha":null,"homepage":"https://pkgs.rstudio.com/blastula","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstudio.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-13T06:21:56.000Z","updated_at":"2025-05-05T14:45:45.000Z","dependencies_parsed_at":"2024-11-10T21:12:10.529Z","dependency_job_id":"bed486af-0020-4851-a87f-2171eaae5b17","html_url":"https://github.com/rstudio/blastula","commit_stats":{"total_commits":1145,"total_committers":13,"mean_commits":88.07692307692308,"dds":0.03755458515283838,"last_synced_commit":"e9bd2675cc8c43dd03d54db0981cf3444747e2b5"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fblastula","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fblastula/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fblastula/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fblastula/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstudio","download_url":"https://codeload.github.com/rstudio/blastula/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110377,"owners_count":22016391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["easy-to-use","email","html","markdown","r","responsive-email","smtp"],"created_at":"2024-08-03T03:01:23.373Z","updated_at":"2025-12-12T00:54:20.607Z","avatar_url":"https://github.com/rstudio.png","language":"R","funding_links":[],"categories":["R","Backend"],"sub_categories":["Notification Integration"],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ca href='https://rstudio.github.io/blastula/'\u003e\u003cimg src=\"man/figures/logo.svg\" height=\"350px\"/\u003e\u003c/a\u003e\n\n\u003cbr /\u003e\n\u003c!-- badges: start --\u003e\n\u003ca href=\"https://cran.r-project.org/package=blastula\"\u003e\u003cimg src=\"https://www.r-pkg.org/badges/version/blastula\" alt=\"CRAN status\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://opensource.org/license/mit/\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"License: MIT\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/rstudio/blastula/actions\"\u003e\u003cimg src=\"https://github.com/rstudio/blastula/workflows/R-CMD-check/badge.svg\" alt=\"R build status\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://app.codecov.io/gh/rstudio/blastula?branch=master\"\u003e\u003cimg src=\"https://codecov.io/gh/rstudio/blastula/branch/master/graph/badge.svg\" alt=\"Coverage status\" /\u003e\u003c/a\u003e\n\n\u003ca href=\"https://www.repostatus.org/#active\"\u003e\u003cimg src=\"https://www.repostatus.org/badges/latest/active.svg\" alt=\"The project has reached a stable, usable state and is being actively developed.\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://CRAN.R-project.org/package=blastula\"\u003e\u003cimg src=\"https://cranlogs.r-pkg.org/badges/blastula\" alt=\"Monthly Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://CRAN.R-project.org/package=blastula\"\u003e\u003cimg src=\"https://cranlogs.r-pkg.org/badges/grand-total/blastula\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003c!-- badges: end --\u003e\n\n\u003ca href=\"https://www.contributor-covenant.org/version/2/1/code_of_conduct.html\"\u003e\u003cimg src=\"https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg\" alt=\"Contributor Covenant\" /\u003e\u003c/a\u003e\n\u003cbr /\u003e\n\u003c/div\u003e\n\nThe **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.\n\n### Composing an Email Message\n\nWhen 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 (`img_string`).\n\n```r\n# Get a nicely formatted date/time string\ndate_time \u003c- add_readable_time()\n\n# Create an image string using an on-disk\n# image file\nimg_file_path \u003c-\n  system.file(\n    \"img\", \"pexels-photo-267151.jpeg\",\n    package = \"blastula\"\n  )\n\nimg_string \u003c- add_image(file = img_file_path)\n```\n\nNow we use the `compose_email()` function to compose the email. There are three main arguments here: `body`, `header`, and `footer`. You can supply **Markdown** text to any of these content areas to get rendered HTML.\n\nIn the example code below, the strings that are part of the email body and the email footer are combined with `glue::glue()` and, since we have Markdown and HTML fragments, we need to use the `md()` function.\n\n```r\nemail \u003c-\n  compose_email(\n    body = md(glue::glue(\n\"Hello,\n\nThis is a *great* picture I found when looking\nfor sun + cloud photos:\n\n{img_string}\n\")),\n    footer = md(glue::glue(\"Email sent on {date_time}.\"))\n  )\n```\n\nAfter 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.\n\n```r\n# Preview the email\nemail\n```\n\n\u003cimg src=\"man/figures/rstudio_preview_email.png\"\u003e\n\n### Sending an Email Message via SMTP\n\nWe can store SMTP email credentials in a file using the `create_smtp_creds_file()` function. There are also other ways to set up SMTP access credentials (like using system-wide key-value store through the `create_smtp_creds_key()` function).\n\nHaving generated a credentials file, we can use the `smtp_send()` function (along with the `creds_file()` credentials helper function) to send the email through an SMTP server.\n\n```r\n# Sending email by SMTP using a credentials file\nemail |\u003e\n  smtp_send(\n    to = \"jane_doe@example.com\",\n    from = \"joe_public@example.net\",\n    subject = \"Testing the `smtp_send()` function\",\n    credentials = creds_file(\"email_creds\")\n  )\n```\n\n### Sending Email Messages through Posit Connect\n\nWe can also send email based on **R Markdown** files through **Posit Connect**. The `prepare_rsc_example_files()` function provides .Rmd files that facilitate a main report + email report workflow. The key components are the `blastula::blastula_email` output type for the email report, and the use of `render_connect_email()` and `attach_connect_email()` in the main report.\n\n### Installation\n\nWant to try this out? The **blastula** package is available on **CRAN**:\n\n```r\ninstall.packages(\"blastula\")\n```\n\nYou can also install the development version of **blastula** from **GitHub**:\n\n```r\ndevtools::install_github(\"rstudio/blastula\")\n```\n\nIf you encounter a bug, have usage questions, or want to share ideas to make this package better, feel free to file an [issue](https://github.com/rstudio/blastula/issues).\n\n#### Code of Conduct\n\nPlease note that the `rstudio/blastula` project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).\u003cbr\u003eBy participating in this project you agree to abide by its terms.\n\n#### 📄 License\n\n**blastula** is licensed under the MIT license. See the [`LICENSE.md`](LICENSE.md) file for more details.\n\n© Posit Software, PBC.\n\n#### 🏛️ Governance\n\nThis project is primarily maintained by **Richard Iannone**. Should there also be other authors, they might occasionally assist with some of these duties.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fblastula","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstudio%2Fblastula","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fblastula/lists"}