iOS mailCore integration issue
Opened this issue · 1 comments
yihoushuhang commented
Hello the iOS MailCore don't being able to find MCOIMAPMoveMessagesOperation.h file when using CocoaPods and 'MCOSMTPSendOperation' callback not responding when using Carthage.
I use XCode version: 14.0
MCOMessageBuilder *msgBuilder = [[MCOMessageBuilder alloc] init];
//header;
if (displayName != nil) {
msgBuilder.header.from = [MCOAddress addressWithDisplayName:displayName mailbox:mail];
}else{
msgBuilder.header.from = [MCOAddress addressWithMailbox:mail];
}
msgBuilder.header.to = [self mailStringToMCOAddress:to];//transform address function
msgBuilder.header.cc = [self mailStringToMCOAddress:cc];
msgBuilder.header.bcc = [self mailStringToMCOAddress:bcc];
msgBuilder.header.subject = subject;
if (msgParser != nil) {
NSArray *inAttach = msgParser.htmlInlineAttachments;
for (MCOAttachment *attach in inAttach) {
NSString * path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_%@",msgParser.header.messageID,attach.filename]];
NSData *data = [NSData dataWithContentsOfFile:path];
if (data) {
MCOAttachment *temp = [MCOAttachment attachmentWithData:data filename:attach.filename];
temp.inlineAttachment = YES;
[msgBuilder addRelatedAttachment:temp];
}
}
}
if (attachs) {
for (NSString *name in attachs.allKeys) {
MCOAttachment *attach = [MCOAttachment attachmentWithData:[attachs objectForKey:name] filename:name];
[msgBuilder addAttachment:attach];
}
}
//body
[msgBuilder setHTMLBody:body];
NSData *data = [msgBuilder data];
MCOSMTPSendOperation *send = [self.smtpSession sendOperationWithData:data];
[send start:^(NSError * _Nullable error) {
if (error) {
fail(error);
}else {
MCOIMAPAppendMessageOperation *op = [self.imapSession appendMessageOperationWithFolder:@"Sent" messageData:data flags:MCOMessageFlagSeen];
op.progress = ^(unsigned int current, unsigned int maximum) {
NSLog(@"%d--%d",current,maximum);
};
[op start:^(NSError * _Nullable error, uint32_t createdUID) {
if (error) {
NSLog(@"%u---failed%@",createdUID,error.description);
}else {
NSLog(@"success");
}
}];
complete();
}
}];
yihoushuhang commented