0

嗨,我正在尝试在 gmail 中获取电子邮件的完整详细信息,以获取传入邮件的提要,我们必须使用请求标头调用 url https://mail.google.com/mail/feed/atom/然后我必须输入编码的用户名并像这样传递帐户的字 conn.setRequestProperty("Authorization", "Basic " + Base64.encode((username + ":" + password).getBytes()));

我在调用此 url 后用 java 编写代码我正在获取用户的电子邮件提要,但我想了解单个电子邮件的完整详细信息,因为提要中的摘要元素非常短我想获得一封电子邮件的完整摘要,我将收到邮件在获取 id 后,此提要中的 id 使用什么请求标头或参数调用哪个 url,以获取有关特定电子邮件的完整信息,我在此示例中使用 clientlogin。这是代码片段

URL url2=new URL("https://mail.google.com/mail/feed/atom/");

        HttpURLConnection conn=(HttpURLConnection)url2.openConnection();
          conn.setDoOutput(true);
          conn.setRequestMethod("GET");

      conn.setRequestProperty("Authorization", "Basic " + Base64.encode(("riteshmehandiratta1" + ":" + "shinderjeetji").getBytes()));

        conn.connect();

        BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));



        String line;

        String contents = "";



        while ((line = reader.readLine()) != null) {

          contents += line;

        }


System.out.println(contents);   

用于获取提要。此示例正常工作。如何获取电子邮件详细信息?请帮忙...

4

1 回答 1

0

Gmail 收件箱提要仅返回电子邮件数据的子集,并且仅应用于接收新的电子邮件提醒:

https://developers.google.com/google-apps/gmail/gmail_inbox_feed

如果你想完全控制收件箱,你应该使用 IMAP:

https://developers.google.com/google-apps/gmail/oauth_overview

于 2012-07-16T17:02:56.843 回答