Page 1 of 1

how to build a white list?

Posted: Wed Feb 20, 2008 1:57 am
by middle6
I have a email use it send email to my zimbra mailbox.
then I'll find's email go to my zimbra junk mailbox.
As a zimbra admin, How to build a white list ?or how to copy the filter rule to everyone?

how to build a white list?

Posted: Wed Feb 20, 2008 5:34 pm
by mmorse
You have several options depending if you want to do it globally or individually - I'll discuss a few below:
Global hard-lists:

To add blackist or whitelist entries to your /opt/zimbra/conf/ file, simply add lines in the following format:

[quote] blacklist_from


blacklist_from *[/quote]Note that * is a wildcard so in this example * indicates all email from any user at
When you are finished editing the file, restart Zimbra's spamassassin by issuing the following command at the server prompt (as the zimbra user):

zmamavisdctl restart

Global & personal soft-lists:

Soft lists just add or subtract values to the total score, they don't just allow or block, it's like giving certain accounts or regex's a little help towards one direction in scoring. Checkout your /opt/zimbra/conf/ file, you should see a section like:


@score_sender_maps = ({ # a by-recipient hash lookup table,

# results from all matching recipient tables are summed
# ## per-recipient personal tables (NOTE: positive: black, negative: white)

# '' => [{'' => 10.0}],

# '' => [{'' => -3.0}],

# '' => -5.0}],
## site-wide opinions about senders (the '.' matches any recipient)

'.' => [ # the _first_ matching sender determines the score boost
new_RE( # regexp-type lookup table, just happens to be all soft-blacklist

[qr'^(bulkmail|offers|cheapbenefits|earnmoney|foryou)@'i => 5.0],

[qr'^(greatcasino|investments|lose_weight_today|market.alert)@'i=> 5.0],

# read_hash("/var/amavis/sender_scores_sitewide"),
{ # a hash-type lookup table (associative array)

'' => -3.0,

'' => -3.0,

'' => -3.0,

'' => -3.0,

'' => -3.0,

'' => -3.0,

'' => -3.0,

''=> -3.0,

'' => -3.0,

'' => -3.0,

'' => -3.0,

'' => -3.0,

'' => -3.0,

lc('') => -3.0,

lc('owner-textbreakingnews@CNNIMAIL12.CNN.COM') => -5.0,
# soft-blacklisting (positive score)

'' => 3.0,

'' => 1.0,

[/quote]Personal hard-list:

[quote]zmprov ma +amavisWhiteListSender +amavisWhiteListSender[/quote]To put that in the UI is: Bug">>Bug 6953 - Per user spam white lists in the UI

(opposite is amavisBlackListSender

Personal mail-filter methods:

1) Preferences> mailfilters > make one with the action discard or move to junk (the users can do this one)

2) zmmailbox:

[quote]addFilterRule(afrl) [opts] {name} [*active|inactive] [any|*all] {conditions}+ {actions}+

-f/--first add as first filter rule

-b/--before add before filter-name

-a/--after add after filter-name

-l/--last add as last filter rule
deleteFilterRule(dfrl) {name}
modifyFilterRule(mfrl) {name} [*active|inactive] [any|*all] {conditions}+ {actions}+

header "name" is|not_is|contains|not_contains|matches|not_matches "value"

header "name" exists|not_exists

date before|not_before|after|not_after "YYYYMMDD"

size under|not_under|over|not_over "1|1K|1M"

body contains|not_contains "text"

addressbook in|not_in "header-name"

attachment exists|not_exists



fileinto "/path"

tag "/tag"

mark read|flagged

redirect "address"

stop[/quote]Like:[quote]zmmailbox -z -m addFilterRule "tag special" active any header "subject" contains "special" tag "special" discard[/quote]3) zmprov:

[quote]zmprov modifyAccount zimbraMailSieveScript 'require ["fileinto", "reject", "tag", "flag>

[/quote]Note that the personal filters method would only be useful for unwanted unless you change the behavior:

In ZCS 5.0.1 and earlier, user filters were run before the spam filter check was run. This meant that if the user filtered mail into a folder, spam would not be identified and sent to the Junk folder.

Beginning with 5.0.2, spam check is completed first and messages identified as spam are moved to the Junk folder. With this change, users cannot write a filter to move false positive spam out of the Junk folder.
If you prefer ZCS 5.0.2+ to use the spam filter function as it works for 5.0.1 and earlier, you can set the zimbraSpamApplyUserFilters option to True.

This can be done by COS:

zmprov mc COSname zimbraSpamApplyUserFilters TRUE

or for individual accounts:

zmprov ma zimbraSpamApplyUserFilters TRUE

how to build a white list?

Posted: Wed Feb 20, 2008 6:52 pm
by brained

ACC=`/opt/zimbra/bin/zmprov gaa`

for i in $ACC


/opt/zimbra/bin/zmmailbox -z -m $i gact | grep -u email: | sort | uniq | sed -e 's/email:/whitelist_from/g' >> /tmp/autowhitelistall.tmp


sed -i '/' /tmp/autowhitelistall.tmp

sed -i '/' /tmp/autowhitelistall.tmp

... Repeat for each domain on the Zimbra server ...

cat /tmp/autowhitelistall.tmp | sort | uniq > /opt/zimbra/conf/spamassassin/

rm -f /tmp/autowhitelistall.tmp

/opt/zimbra/bin/zmamavisdctl restart

It's ugly but does the job and it's easy for end users to understand that addressbook = whitelist.

how to build a white list?

Posted: Thu Aug 28, 2008 11:13 am
by Russianspi
Brian: does this still work? It looks like a neat solution, and I would love to be able to tell my users that they can just add someone to their address book to keep them out of the Spam folder. Also, how/how often do you run it (nightly cronjob, etc?)

how to build a white list?

Posted: Fri Oct 24, 2008 3:30 pm
by kej263
works for me on 5.0.10

how to build a white list?

Posted: Mon Oct 27, 2008 9:23 am
by Russianspi
Thanks. I'll give it a try.