Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

Is there a way to find/read the Sender Email Address using R, RDCOMClient

$
0
0
library("tm")
library("NLP")
library("dplyr")
library("readtext")
library("readxl")
library("foreach")
library("devtools")
library("RDCOMClient")
library("rlist")

WDF = vector()
OutApp <- COMCreate("Outlook.Application")
outlookNameSpace = OutApp$GetNameSpace("MAPI")

folderName = "Folder Name"
fld <- outlookNameSpace$GetDefaultFolder(6)
fld = fld$folders(folderName)
Cnt = fld$Items()$Count()
emails <- fld$items
df = data.frame(sno = 1:Cnt,Text = "",stringsAsFactors=FALSE)

for(i in 1:10){
  d = as.data.frame(emails(i)$Body(), stringsAsFactors=FALSE)
  df$Text[i] = d[1]
  df$Sender[i] = emails(i)[['SenderName']]
  df$To[i] = emails(i)[['To']]
  df$sub[i] = emails(i)[['subject']]
}
emails(2)[['SenderName']] 

I'm trying to get the senders Email Address by using following code : emails(2)[['SenderEmailAddress']]

But it ends up giving like this : [1] "/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=E4CD239AB9F44AC4AC0A4015B6F4805A-RATINGSDIRE"


Viewing all articles
Browse latest Browse all 29748

Trending Articles