I am new to using Library mailR and search a lot on google but couldn't found anything useful.
I have 2 html table in R, i want to sent them using MailR library in mail body but when i'm sending the mail both table looks like joined to each other.
How to tweak mail body using MailR library.
I want mail Looks like below mentioned format.
Hi Team,
"some sentence here" using t.start and nrows() in the sentence
space
"some sentence here:
I am using the code to make table something like this:
Table1<-DF%>% tableHTML(rownames = FALSE,
widths = rep(100, 13),
second_headers = list(c(1, 6, 6),
c("", "ABC", "XYX")),
caption = "ABC Stat") %>%
add_css_caption(css = list(c("font-weight", "border"),
c("bold", "1px solid black")))%>% add_css_row(css = list(c("background-color"), c("lightblue")), rows = 0:2)%>%add_css_caption(css = list(c("background-color"), c("lightblue")))
and same code for table2
And to send e-mail the code looks like:
library(mailR)
sender<-"a12db@gmail.com"
recipients<-c("xyc@gmail.com")
sm<-list(host.name = "smmm.gmail.com", port = 123,
user.name="a12db@gmail.com",
passwd="1#4$12#", ssl=TRUE)
send.mail(from=sender,
to=recipients,
subject = paste0("Abc Repo"),
body = paste("Some sentence",Table1,"\br",Table2),
html = TRUE,
inline = FALSE,
smtp = sm,
authenticate = TRUE,
attach.files =("abc.csv") ,
send = TRUE )