I am trying to send an email using R where the script calls a separate RMarkdown document to generate an HTML document which will be used as the body of the email. The issue I'm running into is that the email is clipped almost entirely and I have to click the "View Entire Message" link which loses some of the formatting.
I've read that the main culprit is when the email is larger than 102kb in size, but even when using a blank rmarkdown document and generating a blank HTML file to use as the email body the file size seems to still be too big.
Below is my blank RMarkdown file called Daily Email.Rmd
---
title: "Daily Email 2"
output: html_document
date: "2023-12-07"
---
and below is the R script to render the RMarkdown doc and send it out.
library(tidyverse)
library(blastula)
rmarkdown::render("Daily Email .Rmd",
output_file = "Daily Email.html")
htmlDoc <- read_file("Daily Email.html")
email <- compose_email(body = md(glue::glue("{htmlDoc}")))
email %>%
smtp_send(
to = "[email protected]",
from = "[email protected]",
subject = "Daily Email",
credentials = creds_envvar(
user = "[email protected]",
pass_envvar = "SMTP_PASSWORD",
provider = "gmail"
)
)
Any thoughts as to why my email is getting clipped and what I can do to fix it?