Automating some user tasks: forwarding, away/vacation etc

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
16326troublemaker
Advanced member
Advanced member
Posts: 50
Joined: Sat Sep 13, 2014 12:06 am

Automating some user tasks: forwarding, away/vacation etc

Post by 16326troublemaker »

Hello!
Recently I ran into stupid situation. My users uses MS Outlook as primary mail client, getting/sending their mails via POP3/SMTP to/from Zimbra mail server (OSE).
The email processing is not the main task of them - they have much more jobs to do than simple r/w email. That is why we need to automate some processes.
Well, I know about zmprov ma ACCT zimbraPrefMailForwardingAddress ANOTHERACCT, but how to automate such process?
What exactly I need:
1. admin receives the ticket like "ACCT1 must be forwarded to ACCT2 since DATE1 till DATE2"

2. admin files this information somewhere and:

3. on DATE1 forward address will be set up ACCT1-->ACCT2 and the forwarding will be enabled

4. on DATE2 the forwarding will be disabled (with or without removal of forward-to address)
I thinking about something like cron-executed script, but need some assistance about best way of how to do that.
If anyone have working solution or realized ideas, share them with me please?
Thank you!
p.s. I will not idly wait for answers, and I will attempt to make this automation by myself, but suggestions are highly appreciated.
Krishopper
Outstanding Member
Outstanding Member
Posts: 769
Joined: Fri Sep 12, 2014 10:23 pm

Automating some user tasks: forwarding, away/vacation etc

Post by Krishopper »

You're on the right track. Just set up some database on the side that holds the information about what needs to be done when, and make a script that looks at that database for actionable items and act on them.
16326troublemaker
Advanced member
Advanced member
Posts: 50
Joined: Sat Sep 13, 2014 12:06 am

Automating some user tasks: forwarding, away/vacation etc

Post by 16326troublemaker »

any suggestions on scripting?
1. cron/AT script like
su -c "some-another-script-visible-to-zimbra $1 $2 $3 $4" - zimbra

#1 - forwarding start date

#2 - account to be forwarded from

#3 - forwarding end date

#4 - email of account which is to receive forwarded mail
2. abovementioned script for zimbra (pseudocode!!!):
#if forwarding begin date reached or due, then set up forward address

if date(today)>=date($1)

then ~/bin/zmprov ma $2 zimbraprefmailforwardingaddress $4

fi

#if forwarding end date reached or due, then remove forward address

if date(today)>=date($3)

then ~/bin/zmprov ma $2 zimbraprefmailforwardingaddress ""

fi
Then I need the tools for handling these dates and names. I know almost nothing about awk/perl etc :-(
16326troublemaker
Advanced member
Advanced member
Posts: 50
Joined: Sat Sep 13, 2014 12:06 am

Automating some user tasks: forwarding, away/vacation etc

Post by 16326troublemaker »

Well... I did that!

Now sudoer enters smth like:
do-that! start-date end-date forward-from forward-to
and script checks all and everything, and if success, adds proper data to special file.
another script running by cron reads that data file and analyses, if any date is reached. If so, the date processed (on or off) and its record dropped out from data file...
Post Reply