How to iterate through the unread emails and save the attachments to a local folder in R?

48 Views Asked by At

As part of my job responsibilities, I have to open ~55 emails in each day and save the attachments to a local folder. I am tired of doing that manually in each day and looking for ways to automate this. I have found some suggestions through the web and ChatGPT such as mailR package. However, when I tried to run the following code, it throws an error saying that Error in imapConnect "imapConnect" function not found

# Connect to your email account
conn <- imapConnect(
  user = "name.surname@institutionname",
  password = "XXX",
  hostname = "outlook.office365.com",
  ssl = TRUE
)

I appreciate any answer to solve this problem or to offer alternative ways to automate reading the unread emails and saving the attachments to a local folder in R. Thank you for your attention beforehand.

0

There are 0 best solutions below