• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Extract Text From NSLabels to Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Extract Text From NSLabels to Mail (From: PJBorges <email@hidden>)
 >Re: Extract Text From NSLabels to Mail (From: Ken Thomases <email@hidden>)
 >Re: Extract Text From NSLabels to Mail (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: What controller functions should be implemented in what files?
  • Next by Date: NSImage
  • Previous by thread: Re: Extract Text From NSLabels to Mail
  • Next by thread: Ports for stringWithContentsOfURL
  • Index(es):
    • Date
    • Thread