When including an html table within the body one-mail, it never keeps its format.
CODE:
How I expected the table to look like:
image
How it actually looked like:
Captura de pantalla 2021-05-10 a las 13 53 59
Code:
`library(kableExtra)
library(mailR)
example <- data.frame(id = c("id1", "id2"),
customer_id = c("1", "15"),
status = c("check issues", "this is a very long character string to try text wrapping. Have a nice day, have a nice week."))
When including an html table within the body one-mail, it never keeps its format.
CODE:
How I expected the table to look like: image
How it actually looked like: Captura de pantalla 2021-05-10 a las 13 53 59
Code:
`library(kableExtra) library(mailR)
example <- data.frame(id = c("id1", "id2"), customer_id = c("1", "15"), status = c("check issues", "this is a very long character string to try text wrapping. Have a nice day, have a nice week."))
html_tab <- example %>% kbl() %>% kable_styling(bootstrap_options = c("striped", "hover")) %>% column_spec(1:2, width = "2cm") column_spec(3, width = "5cm", background = "lightgrey")
text <- paste0(' Hi, check this table please:', html_tab)
send.mail(from = email_from, to = email_to, subject = "test", body = text, smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = email_from, passwd = my_password, ssl = TRUE), authenticate = TRUE, html = TRUE, send = TRUE)`