简体   繁体   English

如何从数据框列中提取电子邮件 ID 并使用 R 自动发送邮件

[英]How to extract email ids from a data frame column and send mail automatically using R

I am using the RDCOMClient library to automate outlook mails from R. Now the count of recipients' mail id changes periodically.我正在使用 RDCOMClient 库来自动化来自 R 的 Outlook 邮件。现在收件人的邮件 ID 计数会定期更改。 Is there any way to automatically access the ** Email ID ** column in a data frame, say df, and send mail automatically?有没有办法自动访问数据框中的 ** Email ID ** 列,比如 df,并自动发送邮件?

Below is the existing code with static 2 recipients.下面是带有静态 2 个收件人的现有代码。

library(RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]]=paste("abc@xyz.com","kksk@xyz.com", collapse=NULL)

Sure it sounds easy enough.当然,这听起来很容易。 Consider the following Dataframe考虑以下数据框

df <- data.frame(emails = c("abc@xyz.com","kksk@xyz.com", 'yyz@tup.org'))
recipients <- df$emails
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]]=paste(recipients)
recipients

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM