Search code examples
ioscocoaemailimapmailcore

retrieving mails from IMAP server?


I'm trying to read a message from gmail IMAP server using MailCore API. I'm working on this since two days but couldn't solve it. Help me with that how can I retrieve my first email from inbox folder and display it as a string. My code is:

    CTCoreFolder *inbox=[[CTCoreFolder alloc]initWithPath:@"INBOX" inAccount:account];
    NSArray *messageSet=[inbox messagesFromSequenceNumber:1 to:0    withFetchAttributes:CTFetchAttrEnvelope];
    NSString *s=[[messageSet objectAtIndex:0] body];

Solution

  • The GMail root folder is called "[Gmail]" not "INBOX" as is otherwise common.