【发布时间】:2021-06-04 20:29:03
【问题描述】:
我目前有 5 个电子表格,需要分别发送到 5 封电子邮件中。
这是我目前对电子邮件的逻辑:
#Script to send out
attachments <- c('C:/Users/santi/Documents/Cost Changes xlsx/spreadsheet.xlsx') #spreadsheet variable
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = paste("john_doe@outlook.com"
, sep=";", collapse=NULL)
outMail[["subject"]] = " Rebate"
outMail[["body"]] = "Hi -
Attached is the spreadsheet
Let me know if you have any questions, thanks.
This is an automated message from RStudio please respond if you find any errors.
"
purrr::map(attachments, ~ outMail[["attachments"]]$Add(.))
outMail$Send()
我将如何迭代此以发送 5 封单独的电子邮件,同时附加相关的电子表格?
【问题讨论】:
标签: r for-loop email automation rdcomclient