I am trying to download gmails from my gmail account. Most importantly I am interested in downloading the actual content of the mail along with other parameters receipt time, subject, to and from address. I have tried using gmailr and edeR packages. While gmailr helps in sending mails (which I have tried successfully, edeR helps in downloading only the topline data and not the message body. I am seeking this data to test an classification model. Is there a way to do it in R...I am not familiar with any other language.
You could manually retrieve an archive of your gmail and use convert_mbox_eml()
from the tm.plugin.mail
package to convert your .mbox
(several mails in a single box) into an eml
format (every mail in a single file) and then load it in a VCorpus
using readMail
:
library(tm)
library(tm.plugin.mail)
mail <- paste0(getwd(), "/mail")
convert_mbox_eml("yourarchive.mbox", mail)
vc <- VCorpus(DirSource(mail), readerControl = list(reader = readMail))