Copy Whitelist/Blocklist Addresses

Summary: Copies the addresses of enabled “Is Equal to” “From (address)” whitelist or blocklist rules to the clipboard.
Requires: SpamSieve
Install Location: ~/Library/Scripts/Applications/SpamSieve
Last Modified: 2015-05-12

Description

This script copies the addresses of enabled “Is Equal to” “From (address)” whitelist or blocklist rules to the clipboard. This is useful, e.g. if you want to add the addresses to a server-side whitelist 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", "Whitelist"} default button "Whitelist"
    
if button returned of the result is "Whitelist" then
        
set _ruleList to whitelist
    
else
        
set _ruleList to blocklist
    
end if
    
tell _ruleList
        
set _addresses to text to match of every rule whose match field is from field and match style is exact style and isEnabled is true
        
set AppleScript's text item delimiters to return
        
set _string to _addresses as string
        
set the clipboard to _string
    
end tell
end tell