Script fails if invoked from Mail's menu

I seem to have posted this in the wrong area the first time, so I’ll just point to it from here:

http://bbs.applescript.net/viewtopic.php?t=5987

and add one more piece of information. The script works if
double-clicked in Finder
run from Script Editor
selected from the global Script Menu

but fails if
selected from Mail’s own script menu.