R使用sendmailR发送带附件的电子邮件

时间:2014-08-23 19:29:16

标签: r sendmailr

我正在尝试使用sendmailR在R中附加文件。

这可能吗?

不包括attach.files行发送电子邮件而没有问题。

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"))}"

1 个答案:

答案 0 :(得分:0)

试试下面的代码:

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"))}