Any way to bulk create custom folders and filters?

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
crnjaz
Posts: 21
Joined: Mon Mar 28, 2016 12:46 pm

Any way to bulk create custom folders and filters?

Post by crnjaz »

So, i want to create a custom (lets call it "SPAM") folder in root (next to inbox, junk, tresh...) and set up a custom filter that will file mail in that folder directly.
Is there any way to do it for multiple users at once, or do I have to go user by user and set it up manually?
User avatar
ccelis5215
Outstanding Member
Outstanding Member
Posts: 632
Joined: Sat Sep 13, 2014 2:04 am
Location: Caracas - Venezuela
ZCS/ZD Version: 8.8.15.GA.3869.UBUNTU18.64 P12

Re: Any way to bulk create custom folders and filters?

Post by ccelis5215 »

crnjaz wrote:So, i want to create a custom (lets call it "SPAM") folder in root (next to inbox, junk, tresh...) and set up a custom filter that will file mail in that folder directly.
Is there any way to do it for multiple users at once, or do I have to go user by user and set it up manually?
Look in https://imanudin.net/2014/12/20/how-to- ... archiving/

ccelis
crnjaz
Posts: 21
Joined: Mon Mar 28, 2016 12:46 pm

Re: Any way to bulk create custom folders and filters?

Post by crnjaz »

ok, so i managed to scrap up something like this code:

Code: Select all

# !/bin/bash
# How to use : ./filter-set

MAIL="$(< mails.txt)" #mails from mails.txt file
for MAIL in $MAILS; do
zmmailbox -z -m $MAILS cf -c red "/SPAM"
zmmailbox -z -m $MAILS afrl "Spam" active any header "subject" contains "your account" fileinto "SPAM" stop   
done
and I get the

Code: Select all

syntax error near unexpected token `do
error, while running it as a zimbra user. (im runninng it from a scripts folder in /opt/zimbra)
what am I doing wrong?
crnjaz
Posts: 21
Joined: Mon Mar 28, 2016 12:46 pm

Re: Any way to bulk create custom folders and filters?

Post by crnjaz »

ok, i figured it had to be some copy/pasting problem, so i typed the file manually, but now im getting the following error:

Code: Select all

./fillter-set.sh: line 5: syntax error near unexpected token `zmmailbox'
./fillter-set.sh: line 5: `zmmailbox -z -m $MAILS cf -c red "/SPAM"'
what am i doing wrong?

edit: i also edited the mail loading line to load it from scripts/mails.txt so i could run it from root zimbra's folder, but still....
Post Reply