I am trying to create a plugin to OSX's Mail.app, a so called mailbundle that adds a custom mail header to the outgoing mail, like a "X-my-org-key: some_text"
I have managed to get it started and can "intercept" the send method but I am not sure if I add the header to the right type of instance since the actually sent mail lacks my header.
The code look like this:
#import "DocumentEditor.h"
#import "ComposeBackEnd.h"
#import "MCMutableMessageHeaders.h"
#import "MCOutgoingMessage.h"
#import "WFRSwizzler.h"
#import "DocumentEditor-WaitForReply.h"
@implementation DocumentEditor_WaitForReply
+ (void) load {
[WFRSwizzler extendClass: @"DocumentEditor"
withClass: @"DocumentEditor_WaitForReply"];
}
- (void) WFR_send: (id) arg1 {
NSLog(@"send Swizzled");
ComposeBackEnd *backEnd = ((DocumentEditor *) self).backEnd;
MCOutgoingMessage *message = [backEnd message];
MCMutableMessageHeaders *headers = [message mutableHeaders];
[headers setHeader:@"some_text" forKey:@"x-my-org-key"];
[self WFR_send: arg1];
}
Any hints are welcome