2

Is is possible to have R connect to gmail's POP server and read/download the messages in a specific folder of mine? I have been storing emails and would like to go back and start to analyze subject lines, etc.

Basically, I need a way to export a folder in my gmail account and I would like to do this pro grammatically if it all possible.

Thanks in advance!

Btibert3
  • 38,798
  • 44
  • 129
  • 168
  • 1
    Does this help? http://stackoverflow.com/questions/4241812/how-can-i-send-receive-smtp-pop3-email-using-r – RoyalTS Dec 19 '12 at 00:58

2 Answers2

2

I am not sure that this can be done via a single command. Maybe there is a package out there, which I am not aware of that can accomplish that, but as long as you do not run into that maybe the following process would be a solution ...

Consider got-your-back (http://code.google.com/p/got-your-back/wiki/GettingStarted#Step_4%3a_Performing_A_Backup) which "is a command line tool that backs up and restores your Gmail account".

You can invoke it like this (given that python is available on your machine):

python gyb.py --email foo@bar.com --search "from:pip@pop.com" --folder "mail_from_pip"

After completion you'll find all the emails matching the --search in the specified --folder, along with a sqlite database. (posted by dukedave, Dec 4 '11)

So depending on your OS you should be able to invoke the above command from within R and then access the downloaded mails in the respective folder.

GWD
  • 1,387
  • 10
  • 22
  • 1
    Perfect. Would love to try to implement this in R someday, but gets the job done for the time being! – Btibert3 Dec 19 '12 at 16:34
0

GotYourBack is a good backup utility, but for downloading metadata for analysis, you might want something that doesn't first require you to fetch the entire content of all your email.

I've recently used the gmailr package to do a similar analysis.

William Gunn
  • 2,925
  • 8
  • 26
  • 22