I'll not tell you how much time I've wasted trying to find a way of using AppleScript to generate a link (filepath or URL) to an individual email message in Mail.app. There are a number of solutions out there, but most involve invoking a shell script to run a Spotlight query from the command line. Clever but cumbersome. However there is an easier way.
The message ID of an email message can be combined with the message:// protocol, which is provided by MailTags, to specify a URL for individual email messages. (MalTags is required in order to use this hint; without it, the message:// protocol isn't recognized.)
The simple AppleScript snippet below shows you how to easily get the message ID for a selected email message in Mail.app. You can then use this URL in your own applications. For example, embed a link to an email message in an iCal event or todo, or even use the URL in web-based applications. I've used message URLs to link email messages to actions in my own PHP-based GTD system. Nice.
Copy/paste the following AppleScript into Script Editor. Then run Mail.app, select an email message, and then run the script. You'll get the idea. Adapt the script for your own purposes.
tell application "Mail"
set theSelectedMessages to selection
set the selected_message to item 1 ¬
of the theSelectedMessages
set message_id to the message id of the selected_message
end tell
set message_url to "message://" & message_id
open location message_url
As far as I know, this trick only works if you use Mail.app, but I've not tried it with other clients.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20070215145127300