简体   繁体   English

从 Gmail 下载包含内容的电子邮件

[英]Download Emails from Gmail With Contents

I want to download all emails with content.我想下载所有包含内容的电子邮件。 I got the REST API to get all emails but it returns only id and threadId, not other fields like labels, recipients, etc.我得到了 REST API 来获取所有电子邮件,但它只返回 id 和 threadId,而不是标签、收件人等其他字段。

Get all email - https://www.googleapis.com/gmail/v1/users/<email-id>/messages/

There is separate api to get all content but it works for single mail.有单独的 api 来获取所有内容,但它适用于单个邮件。 So if I have 100 emails and I get content one by one it will be very slow.因此,如果我有 100 封电子邮件并且我一封一封地获取内容,那将会非常缓慢。

Get content of email - https://www.googleapis.com/gmail/v1/users/<email-id>/messages/<id>

Let me know what is the best way to list emails with contents.让我知道列出包含内容的电子邮件的最佳方式是什么。

The Gmail API supports Batch requests Gmail API 支持批量请求

This allows you to get all your messages in batch rather than 1 by 1.这使您可以批量获取所有消息,而不是一个接一个。

Here is a sample on how to incorporate it in Java.是一个关于如何将其合并到 Java 中的示例。

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

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