EDMessage Example Code?
Can anyone help me make a EDMessage Sample Code? I don't know how to set up my headers and what the proper coding to input into my application. Here's the link if you need resources. BTW EDMessage is a framework used to send emails. EDMESSAGE. Here is the code I have so far for my headers:
#import <Cocoa/Cocoa.h>
@interface Control : NSObject {
IBOutlet NSTextField *inputBox;
IBOutlet NSTextField *outputBox;
IBOutlet NSTextField *accountLabel;
IBOutlet NSWindow *hudWindow;
IBOutlet NSButton *checkBox;
IBOutlet NSWindow *windowRegister;
EDMailAgent *mailAgent;
NSMutableDictionary *headerFields;
NSTask *task;
NSPipe *pipe;
}
- (IBAction)stopButton:(NSButton *)sender;
- (IBAction)quitButton:(NSButton *)sender;
- (开发者_运维百科IBAction)sendButton:(NSButton *)sender;
@end
Sincerely,
Kevin
Hope this helps:
NSMutableArray *partList = [NSMutableArray array];
EDPlainTextContentCoder *tcc1 = [[[EDPlainTextContentCoder alloc] initWithText:text] autorelease];
EDHTMLTextContentCoder *tcc2 = [[[EDHTMLTextContentCoder alloc] initWithText:text] autorelease];
EDMultimediaContentCoder *mcc = [[[EDMultimediaContentCoder alloc] initWithData:data filename:filename inlineFlag:NO] autorelease];
[partList addObject:tcc1];
[partList addObject:tcc2];
[partList addObject:mcc];
EDCompositeContentCoder *ccc = [[EDCompositeContentCoder alloc]
initWithSubparts:partList];
EDInternetMessage *msg = [ccc message];
[ccc release];
id headerFieldBody = [[EDTextFieldCoder encoderWithText:@"john appleseed <a@b.cd>"] fieldBody];
[msg addToHeaderFields:[EDObjectPair pairWithObjects:@"From":headerFieldBody]];
[msg addToHeaderFields:[EDObjectPair pairWithObjects:@"To":headerFieldBody]];
headerFieldBody = [[EDTextFieldCoder encoderWithText:@"A Subject"] fieldBody];
[msg addToHeaderFields:[EDObjectPair pairWithObjects:@"Subject":headerFieldBody]];
精彩评论