I am preparing the Mail iOS application using the MailCore framework. While composing the new mail, How I set the UID for my mails, as mails are sending but it is not moves or copied to the sent box or to the draft folder. When I copy or move the message it get crashed on the line..
NSString *uid = [msg uid];
At the CTCoreFolder Class, in these method ..
- (void)copyMessage: (NSString *)path forMessage:(CTCoreMessage *)msg
- (void)moveMessage: (NSString *)path forMessage:(CTCoreMessage *)msg
as I am creating and sending the message by this way....
CTCoreMessage *msg = [[CTCoreMessage alloc] init];
CTCoreAddress *fromAddress = [[CTCoreAddress alloc] initWithName:@"name" email:@"name@mailserver.com"];
CTCoreAddress *address3 = [[CTCoreAddress alloc] initWithName:@"person" email:@"person@rcscentralmail.com"];
[msg setFrom:[NSSet setWithObject:fromAddress]];
[msg setTo:[NSSet setWithObject:address3]];
[msg setSubject:@"Test simple appfdgfghbfghb"];
[CTSMTPConnection sendMessage:msg server:@"mail.mailserver.com" username:@"abc@mailserver.com"
password:@"abcdef" port:587 useTLS:NO useAuth:YES];
After calling Connecting to server I am calling move or copy method like ::
[folder moveMessage:@"INBOX.Sent" forMessage:message];
Please help.
Thanks James for your support... I got the solution, You can't set the UID, the UID is only assigned by the server. You'll need to append the message to the Sent or Draft mailboxes, this can be done using -(BOOL)append:(CTCoreMessage*) which is on CTCoreFolder. However this method is only in the newest version of MailCore. The changeset can be seen here:
https://github.com/mronge/MailCore/commit/1f64ed5b56fc995613f8fc2dd33d3ff45fe140d0
Thanks to Matt Ronge.