You have a good maintained Address Book and want to feed Spamassassin’s whitelist from it ? Here is the trick :
cd ~/Library/Application\ Support/AddressBook
sqlite3 AddressBook-v22.abcddb \
"select ZADDRESS from ZABCDEMAILADDRESS;" \
| xargs -n 1 echo "whitelist_from " \
| sort > ~/tmp/whitelist
Then, edit ~/.spamassassin/user_prefs, and add the content of ~/tmp/whitelist.
Notice : the sort command is purely optional.
Comments 2
You could write the query as
select “whitelist_from ” || ZADDRESS from ABCDEMAILADDRESS order by 1
and eliminate the xargs and sort steps. If you create a whitelist every day, this would save 2 seconds of cpu time in the next seven years
Posted 02 Nov 2008 at 19:15 ¶Good idea, it needs some escaping but produce the desired result directly :
Posted 02 Nov 2008 at 20:14 ¶cd ~/Library/Application\ Support/AddressBook
sqlite3 AddressBook-v22.abcddb \
"select \"whitelist_from \" || ZADDRESS from ZABCDEMAILADDRESS order by 1" > ~/tmp/whitelist
Post a Comment