Copy Allowlist/Blocklist Addresses
Summary: Copies the addresses of enabled “Is Equal to” “From (address)” allowlist or blocklist rules to the clipboard.
Requires: SpamSieve
Install Location: ~/Library/Scripts/Applications/SpamSieve
Last Modified: 2026-06-30
Description
This script copies the addresses of enabled “Is Equal to” “From (address)” allowlist or blocklist rules to the clipboard. This is useful, e.g. if you want to add the addresses to a server-side allowlist or blocklist.
Installation Instructions · Download in Compiled Format · Download in Text Format
Script
tell application "SpamSieve"
display dialog "Copy addresses from which rule list? Afterwards, you can use the Edit > Paste command to access the addresses." buttons {"Blocklist", "Allowlist"} default button "Allowlist"
if button returned of the result is "Allowlist" then
set _ruleList to allowlist
else
set _ruleList to blocklist
end if
tell _ruleList
-- Fastest version using specialized, built-in support for getting address list
set _string to enabled from addresses text
-- Demonstrate how to use AppleScript `where` clause, but this can run into AppleScript limitations (returning too many objects at once) if you have lots of rules
(*
set _addresses to text to match of every rule whose match field is from field and match style is exact style and enabled is true
set AppleScript's text item delimiters to return
set _string to _addresses as string
*)
-- Demonstrate how to iterate over arbitrarily large rule lists, but this can be slow.
(*
set _count to count of rules
set _addresses to {}
repeat with _i from 1 to _count
set _rule to rule _i
tell _rule
if match field is from field and match style is exact style and enabled is true then
set end of _addresses to text to match
end if
end tell
end repeat
set AppleScript's text item delimiters to return
set _string to _addresses as string
*)
set the clipboard to _string
end tell
end tell