Send one email to the senders of multiple Mail messages

May 24, '07 07:30:00AM

Contributed by: ob1cannoli

As an editor for a school publication, I have a folder in Mail set for content that other students submit. Recently I found myself needing to send one email to every submitter (nearly 150 emails in all!), yet I found that I could not simply do a Command-A and hit Reply.

After a bit of AppleScript work, I came up with this script:

set thesenders to {}
set thesenderstext to ""
tell application "Mail"
  set themessage to the selection
  repeat with i from 1 to the number of items in themessage
    set thesender to (the sender of (item i of themessage))
    if thesenders does not contain thesender then
      set thesenders to thesenders & {thesender}
    end if
  end repeat
  set AppleScript's text item delimiters to ", "
  set thesenderstext to thesenders as text
  set the clipboard to thesenderstext
end tell
It creates a comma-separated list of the senders of the selected messages, and then sets the clipboard to said list (it also removes duplicates). Select a bunch of messages in Mail, run the script, then paste the clipboard's contents into a new message.

[robg adds: This worked as described in my testing.]

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20070521122642952