• 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: sending e-mails by program
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sending e-mails by program


  • Subject: Re: sending e-mails by program
  • From: Michèle Garoche <email@hidden>
  • Date: Mon, 17 Jun 2002 14:24:11 +0200

You just need to do something like this.

Create an NSButton in IB, declare, say, a sendMail action in a controller, retrieve the email address (here an example with an NSTextField (an outlet has been declared in the controller, say emailField) and then in PB write a piece of code like this:

- (IBAction) sendMail: (id) sender
{
NSMutableString *mailUrl = [NSMutableString stringWithString: @"mailto:";];

// Retrieve the email address from the text field
[mailUrl appendString: [emailField stringValue]];

// Send the whole string to the application declared as email client
[[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString: mailUrl]];
}

You can append what you will to the string subject, and so on, also more than an email address.

Hope this helps
Michhle
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Question regarding drawing NSImages
      • From: Ben Mackin <email@hidden>
  • Prev by Date: Re: Testing localization aspects of projects?
  • Next by Date: Re: Wedgies anyone ?
  • Previous by thread: Re: sending e-mails by program
  • Next by thread: Question regarding drawing NSImages
  • Index(es):
    • Date
    • Thread