rstudio / blastula

Easily send great-looking HTML email messages from R
https://pkgs.rstudio.com/blastula
Other
547 stars 85 forks source link

Social image gets added as an attachment and doesn't render in email #279

Open nicole-brewer opened 2 years ago

nicole-brewer commented 2 years ago

I am using Rmarkdown to create my newsletter. I have pared it down here to exemplify my issue. (Note I have used two accents `` instead of three ``` so the code blocks in the Rmarkdown will render correctly. I'm not aware of a way around this)

---
title: "Newsletter"
output: blastula::blastula_email
---

``{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
``

``{r, echo=FALSE, include=TRUE}
blastula::block_social_links(
  blastula::social_link(
    service = "twitter",
    link = "https://twitter.com/purduewhpc",
    variant = "color"
  )
)
``

I send the email using this code:

library(blastula)
library(Microsoft365R)

# turn the Rmarkdown file into an email object
email <- blastula::render_email("Newsletter.Rmd")

outlb <- Microsoft365R::get_business_outlook()

em <- outlb$create_email(email, subject="[Newsletter] Women in HPC at Purdue", to="brewer36@purdue.edu")

em$send()

When I send the email, the image for the twitter social_link is received as an attachment, and the image does not render in the body of the email.

Screen Shot 2022-01-23 at 9 40 52 AM

P.S. Wonderful package, thank you for developing! The real benefit for me is being able to knit Rmarkdown files, because RStudio is where I create most of my publications and the text editor is very clean.

nicole-brewer commented 2 years ago

This also happens when I try to add an image with blastula::add_image(file = "header.png", width='100%')