我想使用gmailR在电子邮件正文中发送data.frame数据。我尝试了同样的htmlTable。 msg = htmlTable(data,rnames = FALSE)
html_bod <- paste0("<p> This is a test email. </p>", msg)
# sending mail
use_secret_file("/Users/abhishekgupta/Downloads/gmailR.json")
msg = htmlTable(data,rnames=FALSE)
html_bod <- paste0("<p> This is a test email. </p>", msg)
# sending mail
use_secret_file("/Users/abhishekgupta/Downloads/gmailR.json")
test_email <- mime(
To = "1234@gmail.com",
From = "1234@pharmeasy.in",
Subject = "Data City Wise",
body = html_bod,
html =TRUE)
send_message(test_email)
答案 0 :(得分:4)
您可以使用html_body()
代替body
参数。
加载包裹:
library(gmailr)
library(tableHTML)
使用tableHTML
创建HTML表格:
msg = tableHTML(mtcars)
在表格前添加一个段落:
html_bod <- paste0("<p> This is a test email. </p>", msg)
创建MIME
消息并发送:
mime() %>%
to("1234@gmail.com") %>%
from("1234@pharmeasy.in") %>%
subject("Data City Wise") %>%
html_body(html_bod) %>%
send_message()
这就是gmail中电子邮件的样子: