[X4U] Need Applescript help for Mail

John McGibney ensignjd at optonline.net
Wed May 11 15:25:05 PDT 2005


I'm trying to setup an applescript for Mail so that it will delete
messages based on these 2 conditions.

condition one
1. mailbox folder is "Temp Save"
2. subject contains the word digest
3. and the date sent is one or more days old

condition two
1. mailbox folder is "Temp Save"
2. delete all messages older than 5 days


Here's the script i wrote. but i can't get the line with subject to
work.

-=-=

tell application "Mail"
      set localMailboxes to "Temp Save"
      if message subject contains "Digest" then
          if date sent is not today then
              delete message
          end if
      else
          if date sent is greater than 5 then
              delete message
          end if
      end if
end tell

-=-=-=

here's the error message:

tell application "Mail"
      get subject
          "Mail got an error: Can't make subject into type reference."


any applescript gurus out there?

John




More information about the X4U mailing list