我正在尝试使用mailR
包通过电子邮件发送HTML表。当我渲染降价文件时,表格如下所示:
但是,当我通过电子邮件发送表格时,表格会失去边界,看起来像这样:
有没有办法确保电子邮件中出现边框?
这是我正在使用的代码。
---
title: "Email Test"
output: html_document
---
## Hello world!
```{r setup, include=FALSE, echo=FALSE}
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(kableExtra))
### Table 1:
```{r table1, include=TRUE, echo=FALSE, results='asis'}
head (mtcars, 10) %>%
rownames_to_column(var = "car") %>%
select (cyl, car, mpg, disp, hp) %>%
arrange (cyl) %>%
kable (escape = FALSE,
align = "clccc") %>%
kable_styling(c("bordered")) %>%
column_spec(1:5, color = "black") %>%
collapse_rows(columns = 1, valign = "middle")
mailR:
library(rmarkdown)
library(knitr)
rmarkdown::render("Email_Test.Rmd")
library(mailR)
send.mail(from = "my.name@myorg.com",
to = "your.name@myorg.com",
subject = "TEST EMAIL",
html = TRUE,
inline = FALSE,
body = "Email_Test.html",
authenticate = TRUE,
smtp = list(host.name = "smtp.office365.com",
port = xxx,
user.name = "my.name@myorg.ca",
passwd = "xxxxxxxxxxxxx",
tls = TRUE)
)