谁能帮我制作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


真诚的

凯文

最佳答案

希望这可以帮助:

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 <[email protected]>"] 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]];

10-08 14:42