简体   繁体   English

使用gmailr从gmail帐户中提取电子邮件

[英]Extracting emails from a gmail account with gmailr

I recently learned how to send emails in R with gmailr. 我最近学习了如何使用gmailr在R中发送电子邮件。

gmailr::send_message(mime(from = "email1@gmail.com", 
            to = "email2@gmail.com",
            subject = "The Great Subject", 
            body = "Hello buddy. How are you?"))

Now, suppose I have the account email2@gmail.com and I would like to get the body of this message I received. 现在,假设我有一个帐户email2@gmail.com,我想获取收到的此消息的正文。 How can I do that in R? 我如何在R中做到这一点? Thank you for your help and suggestions. 感谢您的帮助和建议。

Based on chinsoon12's suggestion, I got the body of the email with 根据chinsoon12的建议,我收到了包含以下内容的电子邮件正文

A <- messages("The Great Subject",
    include_spam_trash = FALSE)
message(id = A[[1]]$"messages"[[1]]$"id")$snippet

I hope it helps you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM