Search code examples
iphoneobjective-ccmailcore

Objective c MailCore message body


I'm trying to get the body of a Mail with MailCore but it's always empty. My code is

    CTCore *folder = [[CTCorefolder alloc] initWithPath:@"INBOX" inAccount:account];
for( CTCoreMessage *msg in [folder messageObjectsFromIndex : 0 toIndex:10] ){
   if([msg.subject isEqualToString:@"test")]){
         // no pb here, it find the good Mail
         NSLog(@"Message Body length : %d", msg.body.length);
         // here the length is 0 and the body is : ""
  }
}

There are other way to get the body, like "msg.HtmlBody" but it is empty too. However on firefox I can see the body which isn't empty. How should I do ?


Solution

  • You must call fetchBody on each message in order to retrieve it from the server.