Detecting default e-mail application

Is there a way to determine which e-mail application as user has set up as their default application?

This is a modified version of a script that gets the default browser. The code is not mine and, unfortnately, I don’t recall the name of the person who wrote it. On my Jaguar setup, it return the path to the default email app.

set email_app_path to GetDefaultEmail()

on GetDefaultEmail()
	set creatorType to word -1 of (do shell script ¬
		"defaults read |grep -C5 U:mailto | grep -w LSBundleSignature")
	set {text:creatorType} to (text of creatorType) as text
	tell application "Finder"
		set {name_, container_path} to ¬
			{name, container} of application file id creatorType
	end tell
	return (container_path as text) & name_
end GetDefaultEmail

if you need something other than the path, such as the app name, there are various ways to get it.

– Rob