2009-10-15 10 views
0

Quelqu'un peut-il m'aider à créer un exemple de code EDMessage? Je ne sais pas comment configurer mes en-têtes et quel est le codage approprié pour entrer dans ma demande. Voici le lien si vous avez besoin de ressources. BTW EDMessage est un framework utilisé pour envoyer des emails. EDMESSAGE. Voici le code que j'ai jusqu'à présent pour mes têtes:EDMessage Exemple de code?

#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 

Sincèrement,

Kevin

Répondre

2

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 <[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]]; 
+0

correct mais qu'en est-les en-têtes? – lab12

+1

http://www.iu.hio.no/~mark/CTutorial/CTutorial.html#Libraries http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks .html – catlan

Questions connexes