This is going to be an ongoing post where I list useful commands that I happen across while managing various Zimbra installations. This is mainly for my own sanity but it has the added benefit of possibly being able to help out someone else. Enjoy!
Increasing the Maximum Allowable Attachment Size
By default, this setting is low. Nowadays it’s acceptable to send attachments larger than 10MB (but not obscenely larger). I don’t like it and I discourage my users from sending large attachments via e-mail but if you feel the need to loosen up this restriction, here are the commands to do that:
su -l zimbra zmprov ms `zmhostname` zimbraFileUploadMaxSize 20971520 zmprov mcf zimbraFileUploadMaxSize 20971520 zmprov ms `zmhostname` zimbraMailContentMaxSize 20971520 zmprov mcf zimbraMailContentMaxSize 20971520 zmprov mcf zimbraMtaMaxMessageSize 20971520 zmmtactl restart
20971520 = 20MB in bytes.
Disabling the Spam Filter
Sometimes it might be desirable to disable spam filtering across an entire domain or COS. For example, if you pay a 3rd party service to do your spam filtering for you.
zmprov md domain.tld +amavisBannedFilesLover TRUE zmprov md domain.tld +amavisSpamLover TRUE
The first command turns off all filetype filtering for the domain “domain.tld” while the second turns off all spam filtering. If you wanted to do this on a per-account basis, you’d do this:
zmprov ma email@example.com +amavisBannedFilesLover TRUE zmprov ma firstname.lastname@example.org +amavisSpamLover TRUE
“ma” stands for “manage account” and “md” stands for “manage domain”. This is used to specify which type of object you are editing/managing. To reverse these changes you would just change the “+” to a “-” in the previous commands or change the “TRUE” to “FALSE”. My understanding is that this:
zmprov ma email@example.com -amavisBannedFilesLover TRUE zmprov ma firstname.lastname@example.org -amavisSpamLover TRUE
Accomplishes the same exact thing that this does:
zmprov ma email@example.com +amavisBannedFilesLover FALSE zmprov ma firstname.lastname@example.org +amavisSpamLover FALSE
(This is an assumption, someone please correct me if I’m wrong.)
Now, it’s also possible to completely disable spam and virus filtering, here’s how to do it:
zmprov -l ms `zmhostname` -zimbraServiceEnabled antivirus zmprov -l ms `zmhostname` -zimbraServiceEnabled antispam
However, if you do this, you will end up with an ugly “***UNCHECKED***” tag inserted into the subject line of every e-mail. To get rid of that you’ll need to edit /opt/zimbra/amavisd/sbin/amavisd and change the following value:
$undecipherable_subject_tag = '***UNCHECKED*** ';
$undecipherable_subject_tag = '';
And then restart Zimbra:
Archiving/exporting/importing a user’s inbox
This is handy if you want to move a user from one server to another, or if you need to export and archive the mailbox of a user who no longer exists.
zmmailbox -z -m email@example.com getRestURL "//?fmt=tgz" > /tmp/user_inbox.tar.gz
Then, to import to another server:
zmmailbox -s -m firstname.lastname@example.org postRestURL "//?fmt=tgz&resolve=reset" /tmp/user_inbox.tar.gz