FROM : Peter Schmidt
DATE : Fri Feb 29 10:39:42 2008
Hello List,
I'm trying to generate an Email via Apple Scripting Bridge. Everything works fine, but can't add an attachment to it. I had tryed several ways, but it doesn't work. Can anybody help me to get it work?
Here ist a code snippet:
AppleMailApplication *mail = [SBApplication applicationWithBundleIdentifier: @"com.apple.mail"];
AppleMailOutgoingMessage *message = [[[mail classForScriptingClass: @"outgoing message"] alloc] init];
NSDictionary *path = [NSDictionary dictionaryWithObject: @"Merkur:Users:schmidt:Desktop:image.tiff" forKey: @"file name"];
[[mail outgoingMessages] addObject: message];
[message setSubject: @"This is my subject";
[message setContent: @"This ist my content";
[message setVisible: YES];
// This doesn't work, but I don't not why.
AppleMailAttachment *attachment = [[[mail classForScriptingClass: @"attachment"] alloc] initWithProperties: path];
[[[message content] attachments] addObject: attachment];
// [attachment setFileName: @"Merkur:Users:schmidt:Desktop:DiscItemDisc.tiff"];
[mail activate];
Thanks so far,
Peter
DATE : Fri Feb 29 10:39:42 2008
Hello List,
I'm trying to generate an Email via Apple Scripting Bridge. Everything works fine, but can't add an attachment to it. I had tryed several ways, but it doesn't work. Can anybody help me to get it work?
Here ist a code snippet:
AppleMailApplication *mail = [SBApplication applicationWithBundleIdentifier: @"com.apple.mail"];
AppleMailOutgoingMessage *message = [[[mail classForScriptingClass: @"outgoing message"] alloc] init];
NSDictionary *path = [NSDictionary dictionaryWithObject: @"Merkur:Users:schmidt:Desktop:image.tiff" forKey: @"file name"];
[[mail outgoingMessages] addObject: message];
[message setSubject: @"This is my subject";
[message setContent: @"This ist my content";
[message setVisible: YES];
// This doesn't work, but I don't not why.
AppleMailAttachment *attachment = [[[mail classForScriptingClass: @"attachment"] alloc] initWithProperties: path];
[[[message content] attachments] addObject: attachment];
// [attachment setFileName: @"Merkur:Users:schmidt:Desktop:DiscItemDisc.tiff"];
[mail activate];
Thanks so far,
Peter
| Related mails | Author | Date |
|---|---|---|
| Peter Schmidt | Feb 29, 10:39 | |
| Manfred Schwind | Feb 29, 14:55 | |
| Peter Schmidt | Feb 29, 16:03 | |
| has | Feb 29, 18:51 | |
| Pavel Kapinos | Feb 29, 20:56 | |
| Peter Schmidt | Feb 29, 21:32 |






Cocoa mail archive

