library(mailR)
library(htmlTable)
x <- head(mtcars) y <- htmlTable(x, rnames = FALSE)
html_body <- paste0("<html><head>
<style>
body{font-family:Calibri, sans-serif;}
table{border-left:1px solid #000000;border-top:1px solid #000000;}
table th{border-right:1px solid #000000;border-bottom:1px solid #000000;font-size:13px; font-weight:bold; margin: 0px; padding-left: 5px; padding-right: 5px; margin: 0px;}
table td{border-right:1px solid #000000;border-bottom:1px solid #000000;font-size:13px; font-weight:normal; margin: 0px; padding-left: 5px; padding-right: 5px; margin: 0px;}
</style>
</head><body><p> This is a test email. Ignore it.</p>",
y,
"</body></html>")
sender <- "[email protected]" recipients <- c("[email protected]")
send.mail(from = sender,
to = recipients,
subject = "Test Email",
body = html_body,
smtp = list(host.name = "smtp.gmail.com",
port = 465,
user.name = "[email protected]",
passwd = "PASSWORD",
ssl = TRUE),
authenticate = TRUE,
html = TRUE,
send = TRUE)
请在这方面帮助我。我想用绿色突出显示值110,用红色突出显示3,用黄色突出显示所有其他值。
1条答案
按热度按时间njthzxwz1#
您可以在'htmlTable'中使用CSS: