### Install blastula from CRAN Source: https://github.com/rstudio/blastula/blob/master/README.md Installs the stable version of the blastula package directly from the Comprehensive R Archive Network (CRAN). This is the recommended method for most users. ```r install.packages("blastula") ``` -------------------------------- ### Install blastula from GitHub Source: https://github.com/rstudio/blastula/blob/master/README.md Installs the latest development version of blastula from the rstudio GitHub repository using the devtools package. This method is useful for accessing the newest features or bug fixes before they are released to CRAN. ```r devtools::install_github("rstudio/blastula") ``` -------------------------------- ### Retrieve SMTP Credentials for Sending Emails Source: https://context7.com/rstudio/blastula/llms.txt Provides examples of using credential helper functions (`creds`, `creds_file`, `creds_key`, `creds_envvar`) to retrieve SMTP configuration when sending emails. This allows choosing the best method for different security and deployment needs, including anonymous SMTP. ```r library(blastula) email <- compose_email(body = md("Test message")) # Method 1: Direct credentials (most secure, interactive) email |> smtp_send( to = "recipient@example.com", from = "sender@gmail.com", subject = "Test Email", credentials = creds( user = "sender@gmail.com", provider = "gmail" ) ) # Method 2: From credentials file email |> smtp_send( to = "recipient@example.com", from = "sender@gmail.com", subject = "Test Email", credentials = creds_file("gmail_creds") ) # Method 3: From system keyring email |> smtp_send( to = "recipient@example.com", from = "sender@gmail.com", subject = "Test Email", credentials = creds_key("gmail") ) # Method 4: Password from environment variable (good for CI/CD) # Set SMTP_PASSWORD environment variable first email |> smtp_send( to = "recipient@example.com", from = "sender@gmail.com", subject = "Test Email", credentials = creds_envvar( user = "sender@gmail.com", provider = "gmail", pass_envvar = "SMTP_PASSWORD" ) ) # Anonymous SMTP (no authentication) creds_anonymous( host = "smtp.example.com", port = 25, use_ssl = FALSE ) ``` -------------------------------- ### Create Multi-Column Article Layouts Source: https://context7.com/rstudio/blastula/llms.txt Shows how to use `block_articles` to create responsive layouts for one to three articles. Articles stack vertically on smaller screens and display side-by-side on larger screens, including images, titles, content, and optional links. ```r library(blastula) email <- compose_email( body = blocks( block_title("Travel Destinations"), block_articles( article( image = "https://i.imgur.com/dig0HQ2.jpg", title = "Los Angeles", content = "Explore the City of Angels with its beautiful beaches, Hollywood glamour, and diverse culture.", link = "https://example.com/la" ), article( image = "https://i.imgur.com/RUvqHV8.jpg", title = "New York", content = "The city that never sleeps offers world-class dining, Broadway shows, and iconic landmarks.", link = "https://example.com/nyc" ) ) ) ) ``` -------------------------------- ### Create SMTP Credentials File Source: https://context7.com/rstudio/blastula/llms.txt Shows how to create a credentials file on disk for SMTP configuration. The file stores authentication details and is saved with restricted permissions (0600) for security. Supports pre-configured providers like Gmail. ```r library(blastula) # Create credentials file for Gmail create_smtp_creds_file( file = "gmail_creds", user = "your_email@gmail.com", provider = "gmail" ) # Prompts for password interactively # Create credentials file for custom SMTP server create_smtp_creds_file( file = "custom_smtp_creds", user = "user@company.com", host = "smtp.company.com", port = 587, use_ssl = TRUE ) ``` -------------------------------- ### Organize Email Content with Blocks Source: https://context7.com/rstudio/blastula/llms.txt Demonstrates how to use the `blocks` function as a container for organizing various `block_*` components within an email's header, body, or footer. It allows for structured layout of titles, text, articles, and social links. ```r library(blastula) email <- compose_email( header = blocks( block_title("Company Newsletter"), block_text("Your monthly update from the team") ), body = blocks( block_title("Featured Articles"), block_articles( article( image = "https://i.imgur.com/XMU8yJa.jpg", title = "Product Launch", content = "Exciting news about our latest release..." ), article( image = "https://i.imgur.com/aYOm3Tk.jpg", title = "Team Update", content = "Meet our newest team members..." ) ), block_spacer(), block_text("Thanks for reading!") ), footer = blocks( block_text("Follow us on social media:"), block_social_links( social_link(service = "twitter", link = "https://twitter.com/company"), social_link(service = "linkedin", link = "https://linkedin.com/company/company") ) ) ) ``` -------------------------------- ### Prepare Test Email Message with Blastula Source: https://context7.com/rstudio/blastula/llms.txt Provides a simple function, prepare_test_message, to create a basic email message object. This is useful for testing SMTP configurations and email sending functionality without needing to compose a full email. ```r library(blastula) # Create a test message test_email <- prepare_test_message() ``` -------------------------------- ### Create Full-Width Text Blocks Source: https://context7.com/rstudio/blastula/llms.txt Details the creation of full-width text blocks using `block_text`, which supports Markdown formatting and text alignment (left, center, justify). These blocks are responsive to screen width. ```r library(blastula) email <- compose_email( body = blocks( block_title("Announcement"), block_text( "This is left-aligned text (the default).", align = "left" ), block_text( "This text is centered for emphasis.", align = "center" ), block_text( md("This text uses **Markdown** formatting with *italics* and `code`."), align = "justify" ) ) ) ``` -------------------------------- ### Store SMTP Credentials in System Keyring Source: https://context7.com/rstudio/blastula/llms.txt Demonstrates storing SMTP credentials securely in the system's key-value store using the `keyring` package. This method is more secure than file-based credentials as passwords are encrypted by the OS. Supports overwriting existing keys and managing them. ```r library(blastula) # Store Gmail credentials in system keyring create_smtp_creds_key( id = "gmail", user = "your_email@gmail.com", provider = "gmail" ) # Prompts for password interactively # Store with custom SMTP settings create_smtp_creds_key( id = "work_email", user = "user@company.com", host = "smtp.company.com", port = 465, use_ssl = TRUE ) # Overwrite existing key create_smtp_creds_key( id = "gmail", user = "new_email@gmail.com", provider = "gmail", overwrite = TRUE ) # View all stored credential keys view_credential_keys() # Delete a credential key delete_credential_key(id = "gmail") ``` -------------------------------- ### create_smtp_creds_file Source: https://context7.com/rstudio/blastula/llms.txt Creates a secure credentials file on disk for SMTP configuration. ```APIDOC ## create_smtp_creds_file ### Description Creates a credentials file on disk containing SMTP configuration. The file is saved with restricted permissions (0600) for security. ### Parameters #### Arguments - **file** (string) - Required - The path to the file to be created. - **user** (string) - Required - The SMTP username. - **provider** (string) - Optional - One of "gmail", "outlook", or "office365". - **host** (string) - Optional - SMTP server host. - **port** (integer) - Optional - SMTP server port. ### Response - **file** (file) - A file on disk containing encrypted SMTP credentials. ``` -------------------------------- ### Render Email Article Blocks Source: https://github.com/rstudio/blastula/blob/master/tests/testthat/_snaps/render_blocks.md Generates table-based layouts for articles, supporting single, double, and triple column configurations with embedded links and content. ```R block_articles_1 block_articles_2 block_articles_3 ``` -------------------------------- ### Sending an Email Message via SMTP Source: https://github.com/rstudio/blastula/blob/master/README.md Shows how to send a composed email message using SMTP credentials stored in a file. ```APIDOC ## Sending an Email Message via SMTP ### Description This section describes how to send an HTML email message using SMTP. It covers storing SMTP credentials securely and using the `smtp_send()` function to dispatch the email. ### Method Not applicable (R code example) ### Endpoint Not applicable (R code example) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r # Sending email by SMTP using a credentials file email |> smtp_send( to = "jane_doe@example.com", from = "joe_public@example.net", subject = "Testing the `smtp_send()` function", credentials = creds_file("email_creds") ) ``` ### Response #### Success Response (200) Email successfully sent via SMTP. #### Response Example (Confirmation of email sent, specific output may vary) ``` -------------------------------- ### Send Email via SMTP with Blastula Credentials File Source: https://github.com/rstudio/blastula/blob/master/README.md Sends an HTML email message using SMTP. This snippet demonstrates storing SMTP credentials in a file using `create_smtp_creds_file()` and then sending the email with `smtp_send()`, referencing the credentials via `creds_file()`. It requires recipient and sender addresses, a subject, and the email content object. ```r # Sending email by SMTP using a credentials file email | smtp_send( to = "jane_doe@example.com", from = "joe_public@example.net", subject = "Testing the `smtp_send()` function", credentials = creds_file("email_creds") ) ``` -------------------------------- ### Render R Markdown as Email with Blastula Source: https://context7.com/rstudio/blastula/llms.txt Explains how to use render_email and render_connect_email to convert R Markdown files into email message objects. render_connect_email automatically adds a footer suitable for Posit Connect recipients. The Rmd file must specify 'blastula_email' as the output format. ```r library(blastula) # Render an email from an .Rmd file # The .Rmd should have: output: blastula::blastula_email email <- render_email(input = "email_template.Rmd") # Send the rendered email email |> smtp_send( to = "recipient@example.com", from = "reports@company.com", subject = "Automated Report", credentials = creds_file("smtp_creds") ) # For Posit Connect with automatic footer email_connect <- render_connect_email( input = "connect_email.Rmd", connect_footer = TRUE ) # Example email_template.Rmd content: # --- # output: blastula::blastula_email # --- # # ```{r setup, include=FALSE} # library(blastula) # library(ggplot2) # ``` # # # Daily Report # # Generated on `r add_readable_time()` # # ```{r plot, echo=FALSE} # ggplot(mtcars, aes(mpg)) + geom_histogram() # ``` ``` -------------------------------- ### Send Test Email with Blastula Source: https://context7.com/rstudio/blastula/llms.txt This snippet demonstrates how to send a test email using the blastula package in R to verify SMTP configuration. It requires the 'blastula' package and a 'email_creds' file for authentication. ```R test_email |> smtp_send( to = "your_email@example.com", from = "your_email@example.com", subject = "blastula Test Message", credentials = creds_file("email_creds") ) ``` -------------------------------- ### Compose Email with Three-Column Article Layout Source: https://context7.com/rstudio/blastula/llms.txt Demonstrates how to compose an email with a body containing a three-column article layout. Each article can include an image and a title. ```r library(blastula) email <- compose_email( body = blocks( block_articles( article(image = "https://i.imgur.com/XMU8yJa.jpg", title = "Taiwan"), article(image = "https://i.imgur.com/aYOm3Tk.jpg", title = "Japan"), article(image = "https://i.imgur.com/ekjFVOL.jpg", title = "Singapore") ) ) ) ``` -------------------------------- ### Send Email via SMTP with Blastula Source: https://context7.com/rstudio/blastula/llms.txt Demonstrates sending emails using the smtp_send function in Blastula. Supports single and multiple recipients, CC/BCC, attachments, and verbose output for debugging. Requires SMTP credentials. ```r library(blastula) # Send to a single recipient email |> smtp_send( to = "colleague@company.com", from = "sender@company.com", subject = "Meeting Reminder", credentials = creds_file("work_email_creds") ) # Send to multiple recipients with CC and BCC email |> smtp_send( to = c("Jane Doe" = "jane@company.com", "John Smith" = "john@company.com"), from = c("Team Lead" = "lead@company.com"), subject = "Team Update", cc = "manager@company.com", bcc = "archive@company.com", credentials = creds_key("work_email") ) # Send with attachments email |> add_attachment(file = "report.pdf") |> add_attachment(file = "data.xlsx") |> smtp_send( to = "client@external.com", from = "analyst@company.com", subject = "Monthly Report with Attachments", credentials = creds_file("smtp_creds") ) # Verbose output for debugging email |> smtp_send( to = "test@example.com", from = "sender@gmail.com", subject = "Debug Test", credentials = creds(user = "sender@gmail.com", provider = "gmail"), verbose = TRUE ) ``` -------------------------------- ### Send Email via Mailgun API with Blastula Source: https://context7.com/rstudio/blastula/llms.txt Shows how to send emails using the send_by_mailgun function, which interfaces with the Mailgun API. Requires Mailgun API key, sending domain URL, and recipient information. Supports sending to multiple recipients. ```r library(blastula) # Create email message email <- compose_email( body = md("# Welcome to Our Service!\n\nThank you for signing up. We're excited to have you on board.\n\nClick the link below to verify your email address."), footer = md("Questions? Reply to this email.") ) # Send via Mailgun API email |> send_by_mailgun( subject = "Welcome - Please Verify Your Email", from = "Welcome Team ", recipients = c("newuser@example.com"), url = "https://api.mailgun.net/v3/yourdomain.com/messages", api_key = "key-your-mailgun-api-key" ) # Send to multiple recipients email |> send_by_mailgun( subject = "Newsletter", from = "Newsletter ", recipients = c( "subscriber1@example.com", "subscriber2@example.com", "subscriber3@example.com" ), url = "https://api.mailgun.net/v3/yourdomain.com/messages", api_key = Sys.getenv("MAILGUN_API_KEY") ) ``` -------------------------------- ### Add Call-to-Action Buttons Source: https://context7.com/rstudio/blastula/llms.txt Creates a professional call-to-action button using add_cta_button. The button is rendered as an HTML fragment with customizable text, URL, and alignment. ```r library(blastula) # Create a CTA button signup_button <- add_cta_button( url = "https://example.com/signup", text = "Sign Up Now", align = "center" ) # Include button in email email <- compose_email( body = md(c( "# Special Offer!", "", "Don't miss out on our exclusive deal.", "", signup_button, "", "Offer expires in 24 hours." )) ) ``` -------------------------------- ### Composing an Email Message Source: https://github.com/rstudio/blastula/blob/master/README.md Demonstrates how to compose an HTML email message using Markdown and HTML fragments, including dynamic content. ```APIDOC ## Composing an Email Message ### Description This section details how to compose an HTML email message using the `blastula` package. It shows how to incorporate dynamic content like formatted dates and images into the email body, header, and footer. ### Method Not applicable (R code example) ### Endpoint Not applicable (R code example) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r # Get a nicely formatted date/time string date_time <- add_readable_time() # Create an image string using an on-disk image file img_file_path <- system.file( "img", "pexels-photo-267151.jpeg", package = "blastula" ) img_string <- add_image(file = img_file_path) # Compose the email with Markdown and HTML fragments 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}.")) ) # Preview the email email ``` ### Response #### Success Response (200) Displays the composed email in the RStudio Viewer. #### Response Example (Image of email preview) ``` -------------------------------- ### Sending Email Messages through Posit Connect Source: https://github.com/rstudio/blastula/blob/master/README.md Explains how to send R Markdown-based email reports through Posit Connect, utilizing specific output types and rendering functions. ```APIDOC ## Sending Email Messages through Posit Connect ### Description This section outlines the process of sending email reports generated from R Markdown files via Posit Connect. It highlights the use of `blastula::blastula_email` output type and functions like `render_connect_email()` and `attach_connect_email()` for integrating email reports with main reports. ### Method Not applicable (R code example) ### Endpoint Not applicable (R code example) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```r # Example setup for Posit Connect email reports (conceptual) # In an R Markdown document: # output: blastula::blastula_email # In a main report R Markdown document: # render_connect_email() # attach_connect_email() ``` ### Response #### Success Response (200) Email report successfully prepared and attached for Posit Connect deployment. #### Response Example (Details on Posit Connect deployment and email sending) ``` -------------------------------- ### Create Title Text Blocks Source: https://context7.com/rstudio/blastula/llms.txt Explains how to create prominent title text blocks using `block_title` within the `blocks()` container. Supports both plain text and Markdown formatting for titles. ```r library(blastula) email <- compose_email( body = blocks( block_title("Monthly Report"), block_text("Here are this month's highlights...") ) ) email <- compose_email( body = blocks( block_title("Welcome to **Our Newsletter**"), block_text("Bringing you the latest updates.") ) ) ``` -------------------------------- ### Add CTA Buttons with Alignment Source: https://context7.com/rstudio/blastula/llms.txt Demonstrates how to add call-to-action buttons to an email using `add_cta_button`. Supports specifying the URL, button text, and alignment (left or right). ```r left_button <- add_cta_button( url = "https://example.com/learn", text = "Learn More", align = "left" ) right_button <- add_cta_button( url = "https://example.com/buy", text = "Buy Now", align = "right" ) ``` -------------------------------- ### Add File Attachments to Email Source: https://context7.com/rstudio/blastula/llms.txt Shows how to attach files to an email message using the `add_attachment` function. Multiple attachments can be added by chaining calls. Supports custom filenames and MIME types. ```r library(blastula) email <- compose_email( body = md("Please find the attached files.") ) |> add_attachment( file = "report.pdf", filename = "Monthly_Report.pdf" ) |> add_attachment( file = "data.xlsx", content_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ) |> add_attachment( file = "summary.csv" ) ``` -------------------------------- ### Format Date and Time for Emails Source: https://context7.com/rstudio/blastula/llms.txt Illustrates the use of `add_readable_time` to create human-readable date and time strings for email content. It can format the current time or a specified POSIXct value, with options to include or exclude date, time, and timezone. ```r library(blastula) current_time <- add_readable_time() date_only <- add_readable_time( time = ISOdatetime(2024, 3, 15, 8, 30, 0, tz = "GMT"), use_time = FALSE, use_tz = FALSE ) time_only <- add_readable_time(use_date = FALSE) email <- compose_email( body = md(glue::glue("Hello, This report was generated on {add_readable_time()}. Regards, Automated System ")) ) ``` -------------------------------- ### Compose HTML Email Message with Blastula Source: https://github.com/rstudio/blastula/blob/master/README.md Composes an HTML email message using Markdown and image content. It utilizes functions like `add_readable_time`, `add_image`, `compose_email`, and `md` from the blastula package, along with `glue::glue` for string interpolation. The email can include a body, header, and footer, and is designed to be responsive across various email clients. ```r # Get a nicely formatted date/time string date_time <- add_readable_time() # Create an image string using an on-disk # image file img_file_path <- system.file( "img", "pexels-photo-267151.jpeg", package = "blastula" ) img_string <- add_image(file = img_file_path) 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}.")) ) # Preview the email email ``` -------------------------------- ### Blastula Combined Block Rendering Source: https://github.com/rstudio/blastula/blob/master/tests/testthat/_snaps/blocks.md Shows the HTML output for a comprehensive block in Blastula, combining a title, spacer, article items, and text. This demonstrates how multiple content elements can be grouped and rendered together. ```html

This is a title block.

 

Japan

Japan is an archipelago consisting of 6,852 islands along East Asia's Pacific Coast.
This is a block of text.
``` -------------------------------- ### Blastula Article Item Rendering Source: https://github.com/rstudio/blastula/blob/master/tests/testthat/_snaps/blocks.md Illustrates the HTML structure for an article item in Blastula. This includes an image, a title, and a description, all linked to an external source. It's designed to display a preview of an article or link. ```html

Japan

Japan is an archipelago consisting of 6,852 islands along East Asia's Pacific Coast.
``` -------------------------------- ### block_social_links Source: https://context7.com/rstudio/blastula/llms.txt Creates a block of social sharing icons with links for email footers. ```APIDOC ## block_social_links ### Description Creates a block of social sharing icons with links. Supports many popular social services with multiple icon style variants. ### Parameters #### Arguments - **...** (social_link objects) - Required - One or more social_link objects created via the social_link() function. ### Request Example block_social_links(social_link(service = "twitter", link = "https://twitter.com/rstudio", variant = "color")) ### Response - **object** (block) - A block object to be used within the footer of a compose_email() call. ``` -------------------------------- ### Render Social Media Links Source: https://github.com/rstudio/blastula/blob/master/tests/testthat/_snaps/render_blocks.md Generates an HTML anchor tag wrapping an image for social media icons, typically used in email footers. ```R social_link_1 ``` -------------------------------- ### Render Email Block Text Source: https://github.com/rstudio/blastula/blob/master/tests/testthat/_snaps/render_blocks.md Generates a div container for email body text with left-aligned styling. ```R block_text ``` -------------------------------- ### Render Email Block Title Source: https://github.com/rstudio/blastula/blob/master/tests/testthat/_snaps/render_blocks.md Generates an HTML h1 header for email titles with specific inline styling for consistent appearance. ```R block_title ``` -------------------------------- ### Compose Email with Markdown Source: https://context7.com/rstudio/blastula/llms.txt Creates an email message object with header, body, and footer sections using the compose_email function. It supports Markdown formatting via the md() helper to structure content. ```r library(blastula) # Create a simple email with Markdown formatting email <- compose_email( header = md("**Weekly Report**"), body = md(" ## Project Update Hello Team, This is our weekly status update with the following highlights: - Feature A is **complete** - Feature B is *in progress* - Bug fixes deployed to production Best regards, The Team "), footer = md("Sent via [blastula](https://rstudio.github.io/blastula)") ) # Preview the email (in interactive session) if (interactive()) email # Create email with custom content width email_wide <- compose_email( body = md("Wide content email"), content_width = "800px" ) ``` -------------------------------- ### Embed Local Images in Email Source: https://context7.com/rstudio/blastula/llms.txt Uses add_image to create an HTML fragment for embedding local images. The function handles Base64 encoding automatically and supports layout options like alignment and width. ```r library(blastula) # Get path to an image file img_file_path <- system.file( "example_files", "test_image.png", package = "blastula" ) # Create HTML fragment for the image img_html <- add_image( file = img_file_path, alt = "Product screenshot", width = 400, align = "center" ) # Include the image in an email email <- compose_email( body = md(c( "Hello,", "", "Here is the image you requested:", "", img_html, "", "Let me know if you need anything else!" )) ) ``` -------------------------------- ### Send Email Message via SMTP Source: https://context7.com/rstudio/blastula/llms.txt Provides a basic structure for sending an email message through an SMTP server using the `smtp_send` function. This function requires an `email_message` object and SMTP credentials, and it supports sending to multiple recipients, CC, and BCC. ```r library(blastula) # Create an email message email <- compose_email( body = md(" ``` -------------------------------- ### Blastula Spacer Block Rendering Source: https://github.com/rstudio/blastula/blob/master/tests/testthat/_snaps/blocks.md Demonstrates the HTML output for a spacer block in Blastula. This block is used to create vertical spacing within an email or document. It typically renders as an empty table row. ```html
 
``` -------------------------------- ### smtp_send Source: https://context7.com/rstudio/blastula/llms.txt Sends an email message through an SMTP server. ```APIDOC ## smtp_send ### Description Sends an email message through an SMTP server. Requires an email_message object and SMTP credentials. ### Parameters #### Arguments - **email** (email_message) - Required - The email object created by compose_email. - **to** (string) - Required - Recipient email address. - **from** (string) - Required - Sender email address. - **subject** (string) - Required - Email subject line. - **credentials** (creds) - Required - Credential object created via creds(), creds_file(), or creds_key(). ### Response - **status** (boolean) - Returns TRUE if the email was sent successfully. ``` -------------------------------- ### Attach Email to Posit Connect Report with Blastula Source: https://context7.com/rstudio/blastula/llms.txt Details how to use attach_connect_email to link an email message to an R Markdown report published on Posit Connect. This enables automated email delivery upon report updates. It supports specifying attachments and optionally including the main report output. ```r library(blastula) # In a main R Markdown document published to Posit Connect: # Render the email from a companion .Rmd file email <- render_connect_email( input = "report_email.Rmd", connect_footer = TRUE ) # Attach the email for Connect to send attach_connect_email( email = email, subject = "Weekly Report Update", attachments = c("data_export.csv", "summary.pdf"), attach_output = TRUE, # Include the main report as attachment preview = TRUE # Show preview in browser during development ) # Conditionally suppress scheduled emails if (nrow(new_data) == 0) { suppress_scheduled_email(suppress = TRUE) } ``` -------------------------------- ### Add Social Links to Email Footer Source: https://context7.com/rstudio/blastula/llms.txt Illustrates how to add a block of social sharing icons with links to an email's footer. Supports various social services and color variants for icons. ```r library(blastula) # Add social links to email footer email <- compose_email( body = md("Check out our content!"), footer = blocks( block_text("Connect with us:"), block_social_links( social_link( service = "twitter", link = "https://twitter.com/rstudio", variant = "color" ), social_link( service = "github", link = "https://github.com/rstudio", variant = "color" ), social_link( service = "linkedin", link = "https://linkedin.com/company/rstudio", variant = "color" ), social_link( service = "youtube", link = "https://youtube.com/rstudio", variant = "color" ) ) ) ) ``` -------------------------------- ### Interpret Markdown for Email Content Source: https://context7.com/rstudio/blastula/llms.txt Uses the md() function to interpret input strings as Markdown-formatted text. This is required for rendering formatted text within email sections. ```r library(blastula) # Use md() to render Markdown formatting email <- compose_email( body = md(c( "# Welcome!", "", "This email demonstrates **bold**, *italic*, and `code` formatting.", "", "Here's a list:", "- Item one", "- Item two", "- Item three", "", "[Click here](https://example.com) for more information." )) ) ``` -------------------------------- ### Embed ggplot2 Visualizations Source: https://context7.com/rstudio/blastula/llms.txt Converts a ggplot2 object into an embedded image within an email using add_ggplot. The plot is rendered as a PNG and Base64-encoded for email compatibility. ```r library(blastula) library(ggplot2) # Create a ggplot visualization sales_plot <- ggplot( data = mtcars, aes(x = wt, y = mpg, color = factor(cyl)) ) + geom_point(size = 3) + labs( title = "Fuel Efficiency vs Weight", x = "Weight (1000 lbs)", y = "Miles per Gallon", color = "Cylinders" ) + theme_minimal() # Convert plot to HTML fragment plot_html <- add_ggplot( plot_object = sales_plot, width = 6, height = 4, alt = "Scatter plot showing fuel efficiency vs weight" ) # Include in email email <- compose_email( body = md(c( "# Monthly Analytics Report", "", "Here are this month's key metrics:", "", plot_html, "", "The data shows a clear negative correlation between vehicle weight and fuel efficiency." )) ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.