Mac OS X Hints reader deef wanted a way to copy multiple selected Mail messages into a text file (making those messages easier to archive and share). He figured out an AppleScript to do the job. Then (as so often happens on the Hints site) another reader came up with a variation on that tip—a simpler way to do much the same thing without the AppleScript (but also without the clarity of the text that script creates). Here’s both methods.
First, the easy way: Select as many messages as you wish and choose File -> Save As. The familiar dialog appears where you can specify a name, location, and file type for your new document. (By default, it will be in Rich Text Format.) All of the contents of each message, including the headers gobbledygook, will be in the document, in reverse chronological order.
If you’d rather save just the text of the messages, without the gobbledygook, you can use the the script that deef developed. Open AppleScript Editor and paste the following into a new script window:
tell application "Mail" set selectedMessages to selection if (count of selectedMessages) is equal to 0 then display alert "No Messages Selected" message "Select the messages you want to collect before running this script." end if set theText to "" repeat with theMessage in selectedMessages set theText to theText & (content of theMessage) as string end repeatend tellon replaceText(find, replace, subject) -- from MacScripter set prevTIDs to text item delimiters of AppleScript set text item delimiters of AppleScript to find set subject to text items of subject set text item delimiters of AppleScript to replace set subject to "" & subject set text item delimiters of AppleScript to prevTIDs return subjectend replaceTextset theText to replaceText("Begin forwarded message:", "", theText)tell application "TextEdit" set theDocument to make new document set text of theDocument to theTextend tell
Save that to /Library/Scripts/Applications/Mail Scripts with a descriptive name such as Collect Text of Messages
. If you don’t already have the AppleScript icon in your menu bar, open the General tab in AppleScript Editor’s preferences pane and enable the Show Script Menu in Menu Bar option.
To use the script, open Mail and select your desired messages. Next, choose your new script from the AppleScript menu bar item’s Mail Scripts submenu. TextEdit will open a new document with the text of the selected messages (but not the headers); you can then do with that text whatever you please.