MacOS – How to copy many emails to a specific folder rather than copy/paste the contents of each message

macosmail.app

I'm trying to create a project folder for some woodworking I will be doing over the next few weeks. Among the first items into this folder is a collection of ~25 emails containing photos and measurements of components on a similar project.

Is there a quick way to copy each of these emails to a specific folder rather than copy/paste'ing the contents of each one?

Best Answer

If the photos and measurements are attachments you could use Automator to download the selected messages to a folder.

enter image description here


Edit: I wrote this AppleScript that will download the message and the attachments for all the selected emails in Mail. Make a new folder in your home directory called Emails and run the following code in AppleScript Editor.

NOTE: Make sure the Emails folder is empty. There may be problems if there are items in it already.

tell application "Mail"
    set the_messages to selection
    repeat with this_message in the_messages
        set message_subject to subject of this_message
        set message_body to content of this_message
        set download_path to "~/Emails/\"" & message_subject & "\""
        set save_path to (POSIX path of ("/Users/" & (short user name of (system info)) & "/Emails/" & message_subject & "/"))

        (* create a directory for the message and attachements *)
        do shell script "mkdir -p " & download_path

        (* save message body into a file *)
        do shell script "echo \"" & message_body & "\" > " & download_path & "/message.txt"

        (* save the attachments *)
        repeat with the_attachment in this_message's mail attachments
            save the_attachment in save_path & ":" & (name of the_attachment)
        end repeat
    end repeat
end tell