如何在R中使用RDCOMClient检索收件人和CC电子邮件地址

时间:2020-02-20 13:27:08

标签: r rdcomclient

我正在尝试使用RDCOMClient阅读Outlook电子邮件。我可以在“收件人”和“抄送”字段中检索除电子邮件ID以外的所有字段。这是相同的代码。

library(RDCOMClient)

OutApp <- COMCreate("Outlook.Application")

search <- OutApp$AdvancedSearch(
  "Inbox",
  "urn:schemas:httpmail:subject LIKE '%Test mail%'"
)

results <- search$Results()
cat("No of mails found:",results$Count(),"\n")

email <- results$Item(1)

email.subject <- email[["Subject"]]
sender.email <- email[["SenderEmailAddress"]]
sender.name <- email[["SenderName"]]
email.body <- email[["body"]]
email.htmlbody <- email[["HTMLbody"]]

email.To <- email[["To"]] #Retrieving only name in the To list not their emails ids
email.CC <- email[["CC"]] #Retrieving only name in the CC list not their emails ids

我想在电子邮件的“收件人”和“抄送”列表中获取电子邮件ID。这样我就可以将回复发送给所有收件人。

0 个答案:

没有答案