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.
Save a message as a file on your computer or in the cloudDouble-click to open the message you want to save, and on the File menu, click Save As. In the Save as dialog box, in the Folder pane, choose a folder, and then the location in that selected folder where you want to save the file.
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))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With