It’s not uncommon to receive email messages jammed with important links and addresses. If you often wish you could save these bits of information without having to archive (and search through) the messages that contain them, you'll be happy to hear that Lion’s version of Automator makes it possible.
For several years now, OS X has included subtle, but useful, "data detectors." Hover your cursor over a date or email address in Apple's Mail, for example, and a little triangle appears. Click this to choose from a number of relevant options: say, to add a date to your iCal calendar or an address to your Address Book list. Among Automator's new features under Lion is the ability to extract data-detector information from compatible documents. This simple workflow harnesses this ability to extract email addresses from a Mail message and place that information in a new TextEdit document. Note that this workflow works only in Lion, not in earlier versions of the Mac OS.
Create the workflow
Launch Automator (/Applications) and in the template sheet that appears, choose Service. Select the Text entry in the Library pane and then drag the Extract Data From Text item from the Actions pane to the workflow area. Within this action select Email Addresses from the Extract pop-up menu. Now drag the New TextEdit document from this same Actions pane to the workflow area. Configure the top of the window to read Service Receives Selected Text in Mail. Save your workflow with a name such as Extract Email Address.
Launch Mail and select the contents of an email message that you’d like to extract embedded email addresses from. From the Mail menu choose Services and then the Extract Email Address service you created. Any email addresses embedded in the body of the message (but not any addresses in the header) will be copied and then pasted into a TextEdit document.
The Extract Data From Text action includes not only the option to extract email addresses but also URLs, dates, physical addresses, and phone numbers, so you can modify this workflow to collect other kinds of data too. For example, if you want to suck all the links out of an email message, choose URLs.
If you find this workflow useful and intend to employ it on a regular basis, assign a keyboard shortcut to it. Do this by launching the Keyboard system preference, selecting the Keyboard Shortcuts tab, choosing Services in the window’s first pane, and then selecting your Extract Email Address workflow in the pane to the right. Click to the far right of the workflow entry and in the field that appears, enter a keyboard shortcut.