Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rendered email contains script tags #323

Open
aronatkins opened this issue Jan 10, 2024 · 2 comments
Open

rendered email contains script tags #323

aronatkins opened this issue Jan 10, 2024 · 2 comments

Comments

@aronatkins
Copy link
Contributor

Given the R Markdown file:

---
title: Something wonderful
---

Some of the content in this document makes its way to the rendered HTML and
some of it is destined for a custom email message. The email message
customizes the subject and the body of the email, while the rendered HTML
contains only this paragraph.

```{r echo = FALSE}
library(blastula)

blastula::attach_connect_email(
    email = blastula::render_connect_email(input = "email.Rmd"),
    subject = "Buy groceries (rmarkdown)",
    attach_output = FALSE,
    preview = FALSE
  )
```

and the accompanying email.Rmd:

Remember to pick up groceries on you way home. Tonight is "breakfast for
dinner" and we're having French Toast!

* Bread
* Eggs
* Butter
* Milk

When rendered, the email message contains script tags and is not presented in some email clients. The gmail browser UI, for example, shows "[Message clipped]".

You can see this HTML by running:

result <- rmarkdown::render("index.Rmd")
md <- attr(result, "rmd_output_metadata", exact = TRUE)
writeLines(md$rsc_email_body_html, "email.html")

This may be an rmarkdown issue rather than a blastula problem, but filing here first.

@aronatkins
Copy link
Contributor Author

Archive showing the email HTML file that was produced.

email.tar.gz

> packageVersion("blastula")
[1] ‘0.3.4’
> packageVersion("rmarkdown")
[1] ‘2.25’

@aronatkins
Copy link
Contributor Author

The script only occurs if the email.Rmd lacks an explicit output. The email HTML does not contain script tags when blastula_email is used.

---
output: blastula::blastula_email
---

I totally missed the need to add an output format when creating my original example.

This may be a non-issue, as a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants