0

I'm trying to attach a file in R using sendmailR.

Is this possible?

excluding attach.files line sends email without issue.

to <- "<me@localhost>"
subject <- "test attachment"
body <- list("test")
attach.files = c("test.jpeg"),
sendmail(from, to, subject, body,
control=list(smtpServer="192.168.0.51"))} 
Error: unexpected '}' in:
"sendmail(from, to, subject, body,
control=list(smtpServer="192.168.0.51"))}"
user3773444
  • 333
  • 3
  • 12
  • Have you tried Googling it? Does [this](http://stackoverflow.com/questions/2885660/how-to-send-email-with-attachment-from-r-in-windows) help? – David Arenburg Aug 23 '14 at 19:31
  • It also looks like you just have a syntax error there. Where does this `}` belongs to? – David Arenburg Aug 23 '14 at 19:38
  • When I save the file I get an error and i've searched google with so results; > saveChart('jpeg') Error in assign(".chob", x, env) : cannot change value of locked binding for '.chob' > dev.off() null device 1 – user3773444 Aug 27 '14 at 23:49

1 Answers1

0

Try the following code:

to <- "<me@localhost>"
subject <- "test attachment"
attachment -> mime_part (x = "test.jpeg")
body <- list("test", attachment)
sendmail(from, to, subject, body,
control=list(smtpServer="192.168.0.51"))} 
Eric Aya
  • 69,473
  • 35
  • 181
  • 253