Re: Sending email with attachments
Re: Sending email with attachments
- Subject: Re: Sending email with attachments
- From: Tim Schröder <email@hidden>
- Date: Tue, 1 Feb 2011 23:33:12 +0100
Lorenzo,
at least with Thunderbird I have found it impossible to communicate with from a Cocoa app. Mail.app, Entourage, Outlook 2011 and Postbox should work with AppleScript which you can address from within your app with the NSAppleScript class. In principle, you just need to give an instance of NSAppleScript the name of the email application and the script code necessary to create a new message and to attach a file to it. The path to the file to be attached can be part of the script code. For example, the script code to accomplish that with Postbox should be like "tell application "Postbox" .. activate .. send message attachment [path to file] .. end tell". However, for scriptable clients you will need different script code as they all use their own 'dialects' of AppleScript.
On how to determine the default mail application, I usually use LSGetApplicationForURL passing "mailto:".
Best,
Tim
Am 01.02.2011 um 23:13 schrieb email@hidden:
> How can one go about doing this and support 10.4-10.6? There are links all over the place pointing to deprecated API's (NSMailDelivery) or frameworks that are 10.5+ (EDMessage, Scripting Bridge), but nothing I can use. All I want to do is open the default mail application, create a new message, attach a file and then allow the user to address it and send. That should not be too difficult, I should think. Is an Automator action the way to go? Can someone help me out?
> Thanks
> _______________________________________________
>
> 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
_______________________________________________
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