Scripting Mail - Redirect on Certain Days of the Week?

I’m scripting at a very basic level, but I’ve read abut the latest 30 pages of posts here without finding the answer. So, I’m either fairly dense or I’ve come up with an actual question…

I’d like to do the following at work: have email that comes to my work account only on Saturday and Sunday be redirected to another email address. That mail will go to a cell phone, so I also need to filter it before it gets redirected so I’m not getting spam on my phone. Seems simple, but I’m stuck. What I think needs to happen is…

  1. Schedule iCal to run a script a couple of times on Sat and Sun.
  2. The script should shut down Mail just in case there was a restart due to a power outage. Then it should activate Mail.
  3. Mail would then check all accounts and through a filter, copy the unread mail that arrived that day to a special folder/mailbox (although I do not think that a script can move the mail in a Smart Folder because Smart Folders are “virtual”…maybe it can?) – If I don’t use the special folder, I’d get all unread mail rather than just what arrives on Sat/Sun.
  4. It would also have to mark the original mail as read.
  5. Then the script would redirect all the mail in the special folder to my cell phone email address and then empty the special folder.
  6. The script then shuts down Mail.

I’ve been trying to piece this together, and obviously I can get Mail to fire up, but I get way out of my depth once I try to 1) identify unread mail in the account Inbox after it has been filtered, B) move it to the “Redirects” mailbox and 3rd) send that mail. Usually I get “NSReceiverEvaluationScriptError: 4”.

I think I may be able to do something with Entourage – use Mail when I’m at my desk during the week and only use Entourage with the “weekend script”, but that is not particularly elegant or nearly as satisfying.

Anyway, if anyone has done something like this, I’d be interested in how you made it happen.

Thanks,
Wayne Crannell