Re: Extract Text From NSLabels to Mail
Re: Extract Text From NSLabels to Mail
- Subject: Re: Extract Text From NSLabels to Mail
- From: PJBorges <email@hidden>
- Date: Sun, 19 Sep 2010 02:32:01 -0700 (PDT)
I got it to work Ken. Your last input helped a lot. Thanks for
explaining it to me. Made it more clear.
I don't know why I got the previous error. But it's gone now. It
occurred whenever I pressed the button that opens Mail. Obviously, the
error relates to my old faulty code.
For anyone who stumbles into the same problem this code extracts the
contents of multiple labels and a textview and inserts them into Mail:
NSString* content = [NSString stringWithFormat:@"%@\n%@\n%@\n%@\n%@\n%@
\n%@\n\n", [[self.messageContent textStorage] string],[self.sumBooks
stringValue], [self.sumBrochures stringValue], [self.sumMagazines
stringValue]];
// create a new outgoing message object. The @"content" string refers
to the text area where you write the actual email
MailOutgoingMessage *emailMessage =
[[[mail classForScriptingClass:@"outgoing message"] alloc]
initWithProperties:
[NSDictionary dictionaryWithObjectsAndKeys:[self.subjectField
stringValue], @"subject", content, @"content", nil]];
Look at the SBSendEmail project from Apple on how to implement send
mail from your app to Mail. Be sure to read the ReadMe file.
http://developer.apple.com/library/mac/#samplecode/SBSendEmail/Introduction/Intro.html
--Philip
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden