Title: SCRIPT, File mailing list messages
The following script will also be posted to my web site, in the “Reply” subfolder, as “File ML messages”.

(* This script will look for outgoing messages whose primary [first] recipient
is a mailing list. The names of the lists that are
recognized must be listed in the property 'listNames' below, and
the name of the folder to which to move that list's messages must
be in the corresponding position in the list 'folderNames'.

Normally Mailing List Manager handles this fine, but I’ve found that in some cases,
particularly when generating replies in an external source such as Digest Viewer,
MLM does not work and my replies end up in Sent Items. This script moves them
where I want them.

I have all my list folders as subfolders of a top level folder called
"Lists". If you do not have them as subfolders, edit the code
that forms the folder name and remove the "of folder "Lists"" at
the end of the line.
*)

property listNames : {"IOMUG", "MacOE-Talk", "applescript-users", "MACSCRPT", "AlpacaTechnicalBeta", "eMA-Talk", "Entourage-Talk", "iBook", "OneClick-Talk", "word-mac"}
property folderNames : {"IOMUG", "OE Talk", "AppleScript", "AppleScript", "Beta Entourage", "eMA-Talk", "Entourage", "iBook", "OneClick", "Word-Mac"}

tell application "Microsoft Entourage"
    set c to current messages
    repeat with aMsg in c
        (*
        Activate the following two if statements, and their corresponding end if’s,
         if this script is NOT being run from an outgoing message rule.
        Comment them out if you plan to run this via a rule since they are not needed.
*)
        if class of aMsg is outgoing message then — Always true if run from outgoing rule
          if delivery status of aMsg is sent then — Always true if run from outgoing rule
            set toWhom to (address of address of first recipient of aMsg)
            set toWhom to text 1 thru ((offset of "@" in toWhom) - 1) of toWhom
            if toWhom is in listNames then
                repeat with i from 1 to count listNames
                    if toWhom is item i of listNames then exit repeat
                end repeat
                set theFolder to item i of folderNames
                set theFolder to folder theFolder of folder "Lists"
                set the storage of aMsg to theFolder
            end if
          end if
        end if
    end repeat
end tell

--
Peace,
Allen Watson <[EMAIL PROTECTED]> XNS name: =Allen Watson
A Mac family since 1984 <http://home.earthlink.net/~allenwatson/>
Applescripts for Outlook Express and Entourage: <http://homepage.mac.com/allenwatson/>

Reply via email to