Re: Idea for better handling of mailinglists
Re: Idea for better handling of mailinglists
- Subject: Re: Idea for better handling of mailinglists
- From: Michelle Steiner <email@hidden>
- Date: Fri, 30 Nov 2007 12:11:43 -0700
On Nov 30, 2007, at 4:34 AM, Florian Lindner wrote:
Why bother? Just make a smart mailbox for each mailing list you
are subscribed to.
As far as I have just checked you can't create a smart mailbox based
on an arbitrary header. However even if it is possible it still
involves creating the smart mailbox and defining the filter whereas
the script solution is just about creating a folder. Furthermore I
still want to have a folder that contains messages that were not
sent through a mailinglist. (all which are not caught by the
script). Since the smart mailbox leaves the messages in their
original place this would involve more configuration.
This script might get you started. It's run manually, but you might
be able to modify it to be run from a rule. It works only if either
the list's to address or the list's reply-to address is the list
address. It is also untested, so it might need some tweaking.
-- Michelle
tell application "Mail"
set foo to the selection
set foo to item 1 of foo
if (to recipient of foo is not {}) then
set toRecipient to item 1 of to recipient of foo
set myTo to true
else
set toRecipient to "No 'to' recipient"
set myTo to false
end if
if (reply recipient of foo is not {}) then
set replyRecipient to reply recipient of foo
set myReply to true
else
set replyRecipient to "No 'reply' recipient"
set myReply to false
end if
set ButtonList to {"Cancel"}
if myTo then copy address of toRecipient to end of ButtonList
if myReply then copy address of replyRecipient to end of ButtonList
set defaultButton to count ButtonList
set address_ to button returned of (display dialog "Which address do
you wish to use for the rule?" buttons ButtonList default button
defaultButton)
set address_ to address of item 1 of to recipient of foo
set AppleScript's text item delimiters to "@"
set folder_name to text item 1 of address_
set AppleScript's text item delimiters to ""
if not (mailbox folder_name exists) then
make new mailbox at end of mailboxes with properties
{name:folder_name}
end if
if not (exists (rule folder_name)) then
set new_rule to make new rule at after rule 1 with properties
{name:folder_name, should move message:true, move message:mailbox
folder_name, stop evaluating rules:true}
tell new_rule
make new rule condition with properties {expression:address_, rule
type:to header, qualifier:does contain value}
set enabled to true
end tell
end if
end tell
--
Homosexuals do not recruit; Christians recruit, and so does the
military.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden