有人可以帮我制作EDMessage示例代码吗?我不知道如何设置我的标题以及输入到我的应用程序中的正确编码。如果您需要资源,这是链接。 BTW EDMessage是一个用于发送电子邮件的框架。 EDMESSAGE。这是我到目前为止我的标题代码:
#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
此致
凯文答案 0 :(得分:2)
希望这会有所帮助:
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]];