C-Command Software Forum

Apple Mail and Hushmail's Junk folder checking

Hushmail has a folder (“Junk”) that is their spam bucket. Unfortunately they also put good emails in it and I want to filter them. I used the following script, which is a variation on the one found here. As the rest of these scripts didn’t work for me either, I would like to know if this is the real script for Apple Mail on Snow Leopard.


on perform_mail_action(info)
	tell application "Mail"
		set _mailbox to mailbox "Junk" of account "Hushmail"
		repeat with _message in messages of _mailbox
			set _source to _message's source
			tell application "SpamSieve"
				set _isSpam to looks like spam message _source
			end tell
			if not _isSpam then
				set read status of _message to false
				set _message's mailbox to mailbox "Inbox" of account "Hushmail"
			end if
		end repeat
	end tell
end perform_mail_action

The script that you pasted in doesn’t look to me like the one at that link (which is newer and should work better). The one that you pasted is meant to be run from a Mail rule, whereas the one at the link will also work when run standalone.

to me it looks the same as they both take a mailbox, enumerate all messages, decides whether it is spam or not and acts accordingly.

But I got it to work. Apparently either SpamSieve and/or Apple Mail are CaSe SeNsItIvE as moving to INBOX made the message appear in Hushmail’s inbox.

Is there a reference of all the scriptable methods, properties, etc. within SpamSieve?


Yes, but in your script that takes place within a handler.

Yes, I think Mail’s scripting is case-sensitive.

Yes, you can use AppleScript Editor to open SpamSieve’s scripting dictionary.


There’s now an official script for doing this: Apple Mail - Server Junk Mailbox.

Whooooaaaaa!! Thread archaeology! lol I got a notification on this thread and it made me wonder. I couldn’t remember creating this one yesterday! Was I that drunk???

Nah, seriously thanks for the heads-up. I downloaded it yesterday and changed what was needed. After a while I saw the message move from “Junk” to the Inbox, so it’s working.