本文介绍了GMail API是否从邮件中检索“发件人",“收件人"等?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

如何使用此代码从邮件中检索,检索,主题等?实际上,我可以检索文件夹(标签)中的邮件列表,但是我想检索fron,to,sender等以显示在网格中

How I can do to retrieve, from, to, subject, etc. from a message with this code ? Actually I can retrive list of message in a folder (label) but i want to retrieve fron, to, sender, etc. to display in a grid

Private Sub LoadMailGrid(ByVal FolderName As String)

        Dim request As Google.Apis.Gmail.v1.UsersResource.MessagesResource.ListRequest = myGMailService.Users.Messages.List("[email protected]")
        request.Q = "label: " + folderName
        Dim messagesList As ListMessagesResponse = request.Execute()

        Dim SubjectList As List(Of GMailMessageSummary) = New List(Of GMailMessageSummary)
        Dim mail As GMailMessageSummary

        For Each Message In messagesList.Messages
            mail = New GMailMessageSummary
            mail.MessageID = Message.Id
            **mail.From = Message.**
            mail.Subject = "Courriel " + x.ToString
            mail.Received = Today
            SubjectList.Add(mail)
        Next

        grdGMail.DataSource = SubjectList
        grdGMail.DataBind()

    End Sub

推荐答案

列表消息仅返回消息ID和线程ID,而不是全部内容(因为这可能是一封完整的电子邮件,可能很大,如25MB).因此,如果您需要所有这些信息,请在循环中调用messages.get().如果只需要标题如收件人",发件人",主题",则可以调用messages.get(format = METADATA),也可以使用您正在使用的语言.

List message just returns the message Ids and thread ids, not the full content (since that could be an entire email which could be huge like 25MB). So if you want certain info on all of them then call messages.get() in the loop. If you only want headers like To, From, Subject then you can call messages.get(format=METADATA), or however it looks in the language you're using.

https://developers.google.com/gmail/api/v1/reference/users/messages/get

这篇关于GMail API是否从邮件中检索“发件人",“收件人"等?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 02:35