• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mail.app rule script -- move messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail.app rule script -- move messages


  • Subject: Mail.app rule script -- move messages
  • From: Anthony Bush <email@hidden>
  • Date: Tue, 18 Jan 2005 18:13:12 -0600

I'm having a similar problem to the one described here (which was never answered):
http://lists.apple.com/archives/applescript-users/2004/Nov/msg00203.html


I've created a single Mail rule that runs an AppleScript for every message. That AppleScript uses the subject/sender/content/etc. of the message to determine what to do. The AppleScript will announce, move, and potentially do anything with the message.

The problem is with the move, which is performed like this:
move theMessage to mailbox theMailbox
The move works fine, but next time Mail checks for e-mail the exact same message is downloaded again (and moved again). The message is downloaded over and over every time Mail checks for e-mail until I intervene (disable the script).


This is not the case when using a rule, instead of an AppleScript, to move the message. However, using a mail rule to do the move defeats the purpose of having the AppleScript detect what to do with the message. (In other words, one would need as many Mail rules as there are destinations, whereas one AppleScript can take care of all destinations).

Here is a sample script which will move all messages that contain "asdf" in the subject to the folder "ASDF Folder":

using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		tell application "Mail"
			repeat with thisMessage in theMessages
				set theSubject to subject of thisMessage
				if theSubject contains "asdf" then
					set theMailbox to "ASDF Folder"
					if the mailbox theMailbox exists then
						move theMessage to mailbox theMailbox
					end if
				end if
			end repeat
		end tell
	end perform mail action with messages
end using terms from

There are other scripts which move mail, but they have the same problem:
http://c-command.com/scripts/spamsieve/apple-mail-move-if-spam

Is this a bug in Mail.app? Are there any workarounds (without using as many Mail rules as there are destinations)?

I'm using OS X.3.7 and Mail.app 1.3.9 (v619). I'm using POP accounts and I've tried several settings for the "Remove copy from server after retrieving a message" option to no avail.

Thanks,
Anthony

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Deep or Bug?
  • Next by Date: really slow repeat loop
  • Previous by thread: Re: Was: Re: Call Objective-C methods from any script, Now: preserving long links in email
  • Next by thread: really slow repeat loop
  • Index(es):
    • Date
    • Thread