I'm going to develope own email- plugin included to my application. At the moment I have a problem with the email forwarding to the third user. There is the code snippet:
EmailApplication.h
MailApplication *mail;
@property(nonatomic, retain) MailApplication *mail;
EmailApplication.m
@synthesize mail
-(void)loadAllEmails{
self.mail = [SBApplication applicationWithBundleIdentifier:@”com.apple.Mail”];
}
-(void)acceptMessageForwarding:(MailMessage *)message To:(NSString *)address{
message.readStatus = YES;
MailOutgoingMessage *forwardMessage = [message forwardOpeningWindow:NO];
[[mail outgoingMessages] addObject: forwardMessage];
MailToRecipient *theRecipient = ...
...
}
The problem is that every time when I'm trying to add forwardMessage to the outgoingMessages- array, application crashes with the output: -[SBElementArray addObject:]: can't add an object that already exists. (MailMessage *)message is ok so the problem is in somewhere else. I have noticed that the same error comes with the email sending script when allocating the new MailOutgoingMessage and changing the classForScriptingClass text from the outgoing message to the another. Do I need some another parameters? Or do I have to do forwarding by another way?