Search code examples
remailsendmailr

Send Email from R with body as integers or list


finlist <- 1:10

library(mailR)
sender <- "[email protected]"
recipients <- c("[email protected]")
send.mail(from = sender,
to = recipients,
subject="From R",
body = finlist,
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name="[email protected]", passwd="Password", ssl=TRUE),
authenticate = TRUE,
send = TRUE)

The above should send out an Email with subject body as 1, 2, 3, ...10. However the following error is received.

Error in file.exists(body) : invalid 'file' argument


Solution

  • try body =paste(finlist, collapse = ",")