This is a short script I use to backup the Zimbra mailbox content for my users.
This has been used on a Zimbra Collaboration Server (ZCS Open Source Edition) 7.2 installation, but should work on earlier versions as well.
I use another script to backup the whole Zimbra installation, but that might be another blog post.
#!/bin/bash -x
# Backup of Zimbra mailboxes using zmmailbox
# Restore of mailbox should be performed using:
# /opt/zimbra/bin/zmmailbox -z -m user@host postRestURL -u https://HOST "//?fmt=tgz&resolve=skip" mailbox-name-date.tgz
BackupFolder="/backup/zimbra"
MailBox="user1 user2 user3 userN"
DateToday=`date -I`
for name in $MailBox
do
sudo -u zimbra /opt/zimbra/bin/zmmailbox -z -m $name@pario.no getRestURL "//?fmt=tgz" > mailbox-$name-$DateToday.tgz
done
The backup files are named mailbox-user1-20120802.tgz mailbox-user2-20120802.tgz …
Tags: bash, getRestURL, postRestURL, Zimbra, zmmailbox
Posted by Hans-Henry Jakobsen
This is a short HOWTO migrate Zimbra mail filter rules from one server to another or even copy the rules from one user and import them to another. These commands are useful to use when you migrate user accounts between servers since mail filters are not migrated using the Zimbra to Zimbra migration script, zmztozmig . I might write a short post about migrating users between Zimbra servers later.
Export the rules to a file named filter_rules.sieve as the zimbra user
# zmprov ga user@example.com zimbraMailSieveScript > filter_rules.sieve
The content of the file could look something like this
# name user@example.com
zimbraMailSieveScript require ["fileinto", "reject", "tag", "flag"];
# Filtername
if anyof (header :contains ["to"] "root@localhost") {
fileinto "foldername";
stop;
}
Copy the filter_rules.sieve file to the other server and import the filter rules by enclosing the filter rules with a single qoutes around the rules
# zmprov ma user@example.com zimbraMailSieveScript 'require ["fileinto", "reject", "tag", "flag"];
# Filtername
if anyof (header :contains ["to"] "root@localhost") {
fileinto "foldername";
stop;
}'
This has been tested on a Zimbra 7.1.1 OSE server after migrating some users mailboxes from a 32-bit Zimbra server to a new 64-bit server.
Tags: howto, migrate, sieve, Zimbra, zimbramailsievescript, zmprov, zmztozmig
Posted by Hans-Henry Jakobsen
This is just a short post describing Zimbra distribution list (mailinglist) commands.
These commands should be run as the zimbra user
# su - zimbra
List all distribution lists
# zmprov gadl
Print only members addresses of a distribution list
# zmprov gdl mailinglist@example.com | grep zimbraMailForwardingAddress: | awk {'print $2'}
Show if a list is member of another distribution list(s)
# zmprov gdlm mailinglist@example.com
Posted by Hans-Henry Jakobsen
This post describes how to configure the command line e-mail client mutt to use your Zimbra IMAP mailbox.
Open the text file .muttrc, located in your home directory. If it does not exist, create it. Add or replace the following lines with your own user ID:
set spoolfile=imaps://mail.example.com/Inbox set folder=imaps://mail.example.com/ set imap_user=username@example.com
If you would like to use your Zimbra Sent and Drafts folders for sent and postponed messages in Mutt, also add the following lines, as above:
set record=imaps://mail.example.com/Sent set postponed=imaps://mail.example.com/Drafts
Mutt can now be used as a e-mail Zimbra client with access to all your mail. You can change folder in mutt by pressing the etter c. If you do not know the name of the folder, just press ?.
Tags: howto, imap, mutt, Zimbra
Posted by Hans-Henry Jakobsen
This is a short post describing how I’ve installed a new language pack to a Zimbra (ZCS) 5.0.10 installation to enable norsk/norwegian language.
# cp *Msg_no.properties /opt/zimbra/jetty/webapps/zimbra/WEB-INF/classes/messages/ # cp *Msg_no.properties /opt/zimbra/jetty/webapps/zimbraAdmin/WEB-INF/classes/messages/ # cp *Keys_no.properties /opt/zimbra/jetty/webapps/zimbra/WEB-INF/classes/keys/ # cp *Keys_no.properties /opt/zimbra/jetty/webapps/zimbraAdmin/WEB-INF/classes/keys/ # cp ZsMsg_no.properties /opt/zimbra/conf/msgs/
# su - zimbra # zmcontrol stop # zmcontrol start
Please note that since this operation will most like have to be repeated the next time you upgrade Zimbra. Mainly because Jetty changes version and the file location changes making the translated files unavailable.
Source: http://wiki.zimbra.com/index.php?title=Translations#Installing_Translations_in_ZCS_Server
Tags: language, norwegian, Zimbra
Posted by Hans-Henry Jakobsen