librelist archives

« back to archive

Strange problem with MailCore2

Strange problem with MailCore2

From:
Eric Gorr
Date:
2013-06-20 @ 20:19
I've got a sample project at github demonstrating the problem...

     https://github.com/ericgorr/badmessage.git

MailCore is having trouble parsing the message

     https://github.com/ericgorr/badmessage/blob/master/badmessage/29193.emlx

in the sample project.

The test code to read the message is found in AppDelegate.m

     https://github.com/ericgorr/badmessage/blob/master/badmessage/AppDelegate.m

and is

    MCOMessageParser* parser = [MCOMessageParser 
messageParserWithData:messageData];
    MCOAbstractPart* mainPart = [parser mainPart];
    MCOAbstractMessage* message = [mainPart message];
    MCOMessageHeader* header = [message header];
    
    NSLog( @"%@", [header subject] );
    NSLog( @"%u", [mainPart partType] );
    
    NSArray* parts = [(MCOAbstractMultipart*)mainPart parts];
    
    NSLog( @"%@", parts );

The message clearly has two parts, but MailCore is reporting zero parts. 
With other messages, this works without any trouble.

The only problem I have noticed with the message is that it does not 
contain the final boundary at the end. Assuming this is the problem, is 
there some standard way of dealing with such issues? If this is a bug, I 
can file an official one and am willing to spend some time fixing it, but 
would need some guidance in understanding the code.

I obtained this message via Apple Mail and connecting to my gmail account.