Powered by Blogger.

How To Make Folder and Filter for Email Archiving

After create archiving with method auto bcc (by senderor by recipient), email archive will always put in inbox. It will make your email archive will mix with sent and received email. For organize archive email sent and received, you can make folder and filter to organize it.
You can create folder and filter via webmail. But, you must login to webmail every users and creates folder and filter. For simple way, you can create via Zimbra CLI.
Folder
1.zmmailbox -z -m user1@imanudin.archive cf -c red "/Archive Email Sent"
The above command will make folder with name Archive Email Sent for user1@imanudin.archive with red colour
1.zmmailbox -z -m user1@imanudin.archive cf -c blue "/Archive Email Received"
The above command will make folder with name Archive Email Received for user1@imanudin.archive with blue colour
Filter
1.zmmailbox -z -m user1@imanudin.archive afrl "Filter Archive Email Sent"active any address "from" all contains "user1@imanudin.net"fileinto "Archive Email Sent" stop
The above command will make filter with situation if from is user1@imanudin.net will be moved into folderArchive Email Sent.
1.zmmailbox -z -m user1@imanudin.archive afrl "Filter Archive Email Received"active any address "to,cc" all contains "user1@imanudin.net"fileinto "Archive Email Received" stop
The above command will make filter with situation if to or cc is user1@imanudin.net will be moved into folderArchive Email Received.
With above example command, every email sent or received will be organized and unmixed in archive user. You can repeat above command for every users archive. For ease the process, you can make simple script based above command
Make the script with name folder-filter and placed in /srv folder
1.vi /srv/folder-filter
fill with the following content
01.# !/bin/bash
02.# $1 =Archive User
03.# $2 = Main User
04.# How to use : ./folder-filter archive-user main-user
05.# Example :
06.# ./folder-filter user1@imanudin.archive user1@imanudin.net
07. 
08.zmmailbox -z -m $1 cf -c blue "/Archive Email Received"
09.zmmailbox -z -m $1 cf -c red "/Archive Email Sent"
10.zmmailbox -z -m $1 afrl "Filter Archive Email Received" active any address "to,cc"all contains "$2" fileinto "Archive Email Received" stop
11.zmmailbox -z -m $1 afrl "Filter Archive Email Sent" active any address "from"all contains "$2" fileinto "Archive Email Sent" stop
save and give execute access
1.chmod +x /srv/folder-filter
run the following command for using as Zimbra user
1./srv/folder-filter archive-user main-user
example
1./srv/folder-filter user1@imanudin.archive user1@imanudin.net
The above command will automatically create folder and filter for user1@imanudin.archive. Do not reverse between main-user with archive-user. If you reverse like this /srv/folder-filter user1@imanudin.net user1@imanudin.archive. The command will create folder and filter for user1@imanudin.net. Whereasuser1@imanudin.net is main user who will be archived
Good luck and hopefully useful 😀
    Blogger Comment
    Facebook Comment