We are using the SBSendEmail Apple code to create an email to be sent by email app.
MailApplication *mail = [SBApplication applicationWithBundleIdentifier:@"com.apple.Mail"];
mail.delegate = self;
MailOutgoingMessage *emailMessage = [[[mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties:
[NSDictionary dictionaryWithObjectsAndKeys:
[self.subjectField stringValue], @"subject",
[[self.messageContent textStorage] string], @"content",
[self.fromField stringValue], @"sender",
nil]];
[[mail outgoingMessages] addObject: emailMessage];
MailToRecipient *theRecipient = [[[mail classForScriptingClass:@"to recipient"] alloc] initWithProperties:
[NSDictionary dictionaryWithObjectsAndKeys:
[self.toField stringValue], @"address",
nil]];
[emailMessage.toRecipients addObject: theRecipient];
[emailMessage send];
Getting this error:
[General] *** -[SBProxyByCode setSender:]: object has not been added to a container yet; selector not recognized [self = 0x600000c85bf0]
Any help with getting this working or an alternate solution would be greatly appreciated!
Thanks John