PowerMail - Uncertain Spam Condition

Summary: Can be used as a mail filter condition to match messages that are barely considered spam.
Requires: SpamSieve, PowerMail
Install Location: PowerMail Files/Custom Scripts
Last Modified: 2014-08-25


Create a mail filter with an AppleScript condition that executes this script. The actions of the filter will be applied only if (a) the message is considered spam, and (b) its spam score is less than the uncertain threshold, which is set at the bottom of SpamSieve’s Notification preferences.

For example, you could set up three PowerMail filters like this:

Spam: evaluate
Evaluates the spam rating of the messages.
Spam: uncertain
Moves uncertain spam messages to the Uncertain Spam folder. Check “Don’t apply subsequent filters to this message” so that the next filter isn’t applied.
Spam: actions
Moves the more spammy spam messages to the Spam folder.

Installation Instructions · Download in Compiled Format · Download in Text Format


tell application "PowerMail"
set {_uncertainThreshold} to my lookupKeys({"Border"}, {75})
set _messages to current messages
repeat with _message in _messages
set _score to spam rating of _message
if _score ≥ 50 and _score_uncertainThreshold then
set filter criterion result to true
end if
end repeat
end tell

on lookupDefaults(_keys, _defaultValues)
tell application "SpamSieve"
set _result to {}
repeat with _i from 1 to count of _keys
set _key to item _i of _keys
set _defaultValue to item _i of _defaultValues
set _value to lookup single key _key default value _defaultValue
copy _value to end of _result
end repeat
return _result
on error -- SpamSieve 2.9.15 and earlier
return lookup keys _keys default values _defaultValues
end try
end tell
end lookupDefaults