Question

I've an application which gives Images as outputs and those outputs are to be opened in a mail client's new message [as an attachment].

On Mac OS X, Apple mail is the default mail client. So what I did was, wrote an automator workflow and opened the output in Mail.app using 'Open Finder Items' action.

Here is my problem:

If user has configured the 'Microsoft Entourage' or 'ThunderBird' or any other mail clients as their default mail client then my automator action cannot open the output in their configured mailing app.

I got some idea to find and launch the default mailing application in this link.

How do I get the default mail client using applescript?

can anyone help me how can I attach my output images to a new mail message of the launched mail client?

Was it helpful?

Solution

For the record, the accepted answer in the linked question was something like this:

tell application "System Events"
    try
        value of property list item "LSHandlerRoleAll" of (property list item 1 of property list item "LSHandlers" of property list file (path to preferences as text) & "com.apple.LaunchServices.plist" where value of property list items contains "mailto")
    on error
        "com.apple.mail"
    end try
end tell

You could also use MMac::InternetConfig:

VERSIONER_PERL_PREFER_32_BIT=1 perl -MMac::InternetConfig -le 'print +(GetICHelper "mailto")[1]'

or DefaultApplication:

$ ~/bin/DefaultApplication -url mailto:
/Applications/Mail.app
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top