I tried this on my Mac which upgraded to macOS Catalina from Mojave. For some reasons, I could not import LaunchServices. It worked on my new MacBook Pro 16”. YMMV.

I wanted to set a default mail client on my MacBook Pro. But I wanted to do so without adding a new mail account in Mail.

import LaunchServices
result = LaunchServices.LSCopyDefaultHandlerForURLScheme('mailto')
print(result)

If you never changed the default mail client, you should see the following output.

com.apple.mail

I am using Spark so I want to find its application bundle identifier. So you can run quick and dirty AppleScript on your shell or Script Editor.

osascript -e 'id of app "Spark"'

In case you want to use Script Editor, just enter:

id of application "Spark"

The output should be: com.readdle.smartemail-Mac.

import LaunchServices
result = LaunchServices.LSSetDefaultHandlerForURLScheme(
    'mailto', 
    'com.readdle.smartemal-Mac')

print('result: %d (%s)', % (result, 'success' if result == 0 else 'error'))

Once you are done, clicking <mailto:...> link should start Spark (or email client of your choice).

References: