This trick isn't just limited to Safari and Mail. You can drag text from many (but not all) applications to the Dock icon of another application to have the dragged-to application act on it. For example:
- If you have text that you want to do a Google search on, drag the text to the Safari icon. A new tab will open in Safari with the Google search results.
- Highlight some text and drag it to the Stickies icon. A new Stickie will be created with from the dragged text. (How to get Stickies to open automatically when you log into your account.)