Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201977

Sending R Markdown output as body email via outlook (RDCOMclient) - R version 3.6.1

$
0
0

I use this exact code (Sending R Markdown output as body email via outlook (RDCOMclient)) and it worked just fine, until I update my version of R to 3.6.1.

I also tried the 3.5 version of RDCOMClient as explained here (RDCOMClient for R 3.6) and I still got NA as body of my mail...

Anyone knows how to fix this??

Edit: (line of code)

knitr::knit("tale_email_body.Rmd", encoding = "UTF-8")  
eb <- read_lines("tale_email_body.html",locale =  locale(encoding = "UTF-8"))     
Encoding(eb)

eb2 <- paste(eb, sep="", collapse="")
eb2 <- iconv(eb2, from = "UTF-8",to= "Latin1")


library(RDCOMClient)

olMailItem <- 0
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(olMailItem)

# this retains default Outlook signature
outMail$GetInspector()
signature <- outMail[["HTMLBody"]]

outMail[["To"]] <- sm
outMail[["CC"]] <- paste("egrp",dm,sep=";")
outMail[["subject"]] <- "note this"
outMail[["BodyFormat"]] <- 2
outMail[["HTMLbody"]] <- paste0(eb2, signature)
outMail$Display()
outMail$Send()

Viewing all articles
Browse latest Browse all 201977

Trending Articles