I tried various fixes such as cleaning caches, testing with different iPhoto libraries, etc. I began to feel the problem was in Mail.app. Stupidly, however, I forgot the standard fix for OS/X problems -- delete the preferences (.plist) file. I did ask on Apple's discussion forum, and I received a helpful response from Robert K:
Apple - Support - Discussions - iPhoto and Mail.app hand on email images ...So the problem is gone for now, until I do something in Mail.app to alter the preferencess in such a way that the problem recurs. I wonder if it's somehow related to having once had a .Mac account then having discontinued it.
> I was having the same problem. Others have advised
> to delete the following file: com.apple.iphoto.plist
> in /users/library/preferences/. This had no effect
> on the freeze. I then deleted com.apple.mail.plist.
> This cured my problem. I did have to set up my mail
> accounts again in mail, but no more freezes when
> sharing a photo from IPhoto and Mail.
Your advice fixed the problem. There were some interesting twists.
I was pretty sure the problem was in Mail.app, not iPhoto, since switching iPhoto libraries had no effect. First I opened com.apple.mail.plist in a plist editor and saved it externally. I figured that would fix any true corruption. Interestingly when copied this file to the Prefs folder and tested I only got the beachball for about 1-2 minutes, then the images appeared. HOWEVER, I then remembered I'd recently set my CPU to higher performance. I suspect there's some odd race condition here and what happened was the race condition resolved before the AppleEvent messages timed out.
Then I deleted my mail prefs file and restored the settings. On testing if Mail.app was running the image appeared instantaneously, if it was not running I got a beachball for five seconds.
So evidently there's some prefs value in com.apple.mail.plist that causes this problem. I have my old prefs file if Apple should want a copy!
I may have identified the cause of this bug. We know that deleting com.apple.mail.plist fixes it. But why? What was "wrong" with the original.
I think the trick is to delete the default .mac account for both sending and receiving. When you do that, and try mailing an image, you'll get the beachball and the appleevent error.
I have to guess for some reason Mail.app is trying to do something with the .Mac account, and when it's missing it hangs.
It doesn't matter whether the .Mac account is active or not, it simply has to exist.