Re: automatically send the email from code using NSWorkspace
Re: automatically send the email from code using NSWorkspace
- Subject: Re: automatically send the email from code using NSWorkspace
- From: "email@hidden" <email@hidden>
- Date: Wed, 23 Sep 2009 09:18:12 +0100
On 23 Sep 2009, at 04:37, jon wrote:
great, found it, Thank you..... do you (or someone) know how to
get the current machine's default Email address for sending email?
rather than typing it into a field like this.
emailMessage.sender = [self.fromField stringValue];
Try the AddressBook frame work. The following gets the logged in user
email address.
ABMultiValue* emailAddresses = [[[ABAddressBook sharedAddressBook] me]
valueForProperty: kABEmailProperty];
if( emailAddresses )
{
NSString* defaultKey = [emailAddresses primaryIdentifier];
if( defaultKey )
{
unsigned int defaultIndex = [emailAddresses indexForIdentifier:
defaultKey];
if( defaultIndex >= 0 )
emailAddr = [emailAddresses valueAtIndex: defaultIndex];
}
}
thanks again,
Jon.
On Sep 22, 2009, at 8:35 PM, Nick Zitzmann wrote:
On Sep 22, 2009, at 8:16 PM, jon wrote:
it works fine, but I want to go ahead and have it automatically
send the email, rather than display the email on screen (ready to
send)...
Can someone point me in the correct direction?
Use NSAppleScript or the scripting bridge. There's some sample code
on ADC that will show you how to use the scripting bridge to send a
message.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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
Jonathan Mitchell
Developer
http://www.mugginsoft.com
_______________________________________________
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