Search code examples
iosobjective-ciphonemailcore2

How to get the folder details for a mail using messageID?


I am using Mailcore2 to fetch mails from IMAP server. If I have a messageID of a mail using that can I get the folder in which it is for Outlook and Yahoo mails?

I am using the following code for fetching messages

 self.imapMessagesFetchOp =
     [self.imapSession fetchMessagesByNumberOperationWithFolder:inboxFolder
                                                    requestKind:requestKind
                                                        numbers:[MCOIndexSet indexSetWithRange:fetchRange]];

     [self.imapMessagesFetchOp start:
      ^(NSError *error, NSArray *messages, MCOIndexSet *vanishedMessages)
      {

        }];

Thanks for any help.


Solution

  • It is not possible to get the folder of mail using the messageID. If you want to know in which folder it is you can the search the messageID in all the folders available but it is not efficient. For further details check the following links

    https://www.rfc-editor.org/rfc/rfc3501

    https://developers.google.com/gmail/imap_extensions