Re: sending e-mails by program
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.