0
finlist <- 1:10

library(mailR)
sender <- "SENDER@gmail.com"
recipients <- c("Recipent@gmail.com")
send.mail(from = sender,
to = recipients,
subject="From R",
body = finlist,
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name="SENDER@gmail.com", 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

Vasim
  • 3,052
  • 3
  • 35
  • 56

1 Answers1

1

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

Batanichek
  • 7,761
  • 31
  • 49
  • Thanks, is there anyway to have the numbers, one below the other as in. (presently its horizontal, would like to have it vertical) – Vasim Nov 19 '15 at 08:44
  • I cant fully understand you but may be you need to try add `"\n"` somwhere/ for examples: `body =paste(finlist, collapse = "\n")` -- give you all numer as column or `body=paste0(paste(finlist[1:9], collapse = ","),'\n',finlist[10])` -- only last numeric on new row – Batanichek Nov 19 '15 at 08:50