Re: [Mail.app] Automated People Sorting
Re: [Mail.app] Automated People Sorting
- Subject: Re: [Mail.app] Automated People Sorting
- From: John Delacour <email@hidden>
- Date: Fri, 1 Aug 2003 20:46:16 +0100
- Mac-eudora-version: 6.0a29
At 10:05 am -0700 1/8/03, Matt Petrowsky wrote:
I was wondering if anyone on this list has an AppleScript that would
work with Mail to automate the following process.
1. Cycle through a selection of multiple messages or one full folder.
2. Determine if sender matches criteria (either in Address Book or
on predefined text list)
3. Moves their messages into a folder (of their name - create if
needed) into a subfolder named People
This is actually something Mail can do well. The script below is
just a _working_and_tested_ example, but it is by no means reliable
-- you need to catch all errors and deal with them properly rather
than mask them in a big try. You also need to parse the address
better to get a good name ('extract name from' is broken) and do all
sorts of other things, but in principle it works and might serve as a
guide for what you want to do.
I have not used the 'move' command in case it does not work in your version.
tell application "Mail"
set _targetmailbox to mailbox "INBOX" of account 1
set _searchstring to "@"
set _people to "People"
if not (exists mailbox _people) then
make mailbox with properties {name:_people}
end if
set ls to messages of _targetmailbox whose sender contains _searchstring
repeat with i in ls
try
set _message to contents of i
set _nameaddress to sender of _message
set my text item delimiters to " <"
set _mailbox to _people & "/" & first text item of _nameaddress
make mailbox with properties {name:_mailbox}
set mailbox of _message to mailbox _mailbox
end try
end repeat
end tell
-- JD
.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.