Mapping Folders: Difference between revisions

No edit summary
No edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Mapping Folders =
{{BC|Community Sandbox}}
__FORCETOC__
<div class="col-md-12 ibox-content">
=MApping Folders=
{{KB|{{Unsupported}}|{{ZCS 7.0}}|{{ZCS 6.0}}|}}
{{WIP}}= Mapping Folders =


== Description ==
== Description ==
Line 9: Line 14:
The magic of using [http://imapsync.lamiral.info/ imapsync] provides an option known as regextrans.  
The magic of using [http://imapsync.lamiral.info/ imapsync] provides an option known as regextrans.  


The regextrans option can be used, with a regular expression syntax, to map all emails being migrated/sync'ed/backed-up/etc from server A into a differently named folder on server B.
The regextrans option can be used, with a regular expression syntax, to map emails from one folder on server A into a differently named folder on server B.


In this example, server A is an Office365 server, which uses 'Sent Items', and server B is a Zimbra server which uses 'Sent'.
In this example, server A is an Office365 server, which uses 'Sent Items', and server B is a Zimbra server which uses 'Sent'.


=== Down to it ===
== Imapsync syntax ==
 
The syntax would be as follows, with the <variables> being specific to your given scenario.
 
<code>
Linux # imapsync --host1 <source server> --user1 <source user> --passfile1 ~/.<a file with user1 password> --ssl1 \<br />
--host2 <target server> --user2 <target user> --passfile2 ~/.<a file with user2 password> --ssl2 \<br />
--syncinternaldates --regextrans2 's/<source folder>$/<target folder>/'
</code>
 
== Example ==


A completely fabricated example will look something like the following:
A completely fabricated example will look something like the following:


<code>Linux # imapsync --host1 <source server> --user1 <source user> --passfile1 ~/.<a file with user1 password> --ssl1 --host2 <target server> --user2 <target user> --passfile2 ~/.<a file with user2 password> --ssl2</code>
<code>
Linux # imapsync --host1 mail.office365.com --user1 user1@mail.office365.com --passfile1 ~/.passfile1 --ssl1 \<br />
--host2 mail.localhost --user2 user2@mail.localhost --passfile2 ~/.passfile2 --ssl2 \<br />
--syncinternaldates --regextrans2 's/Sent Items$/Sent/'
</code>
 
== Notes ==
 
Being a brief article, it is outside the scope here to explain all of the syntax of imapsync - needless to say it can be very powerful when used with cron jobs etc.
 
I have specified --passfile options to assist with streamlining the process - this will not ask for a password and ideally should use <code>chmod 600</code> permissions in a secure location.
 
--regextrans2 uses regular expression syntax, so either hack the example above or [http://en.wikipedia.org/wiki/Regular_expression take a quick read]
 
Taking this one step further, if server A had more than one variant of 'Sent' folder, using the following syntax making the most of wildcards will also help tidy things up during your migration:
 
--regextrans2 's/(.)*Sent(.)*$/Sent/'
 
Effectively moving sent items from any of server A folders into the single Sent folder on server B.
 
HTH
 
[http://wiki.zimbra.com/wiki/User:Costa-101 Costa-101]
{{Article Footer|Zimbra Collaboration 7.0, 6.0|04/16/2014}}

Latest revision as of 10:33, 12 July 2015

MApping Folders

   KB 16941        Last updated on 2015-07-12  




0.00
(0 votes)

Mapping Folders

Description

If you are backing up or migrating from one server to another, you most likely will at some point be dealing with server A using the 'Sent' folder syntax with server B using the 'Sent Items' folder syntax and possibly even server C using the 'Sent Messages' folder syntax.

This page has been created during such an exercise, to provide a simple explanation, with examples, in order to help you get the job done !

The magic of using imapsync provides an option known as regextrans.

The regextrans option can be used, with a regular expression syntax, to map emails from one folder on server A into a differently named folder on server B.

In this example, server A is an Office365 server, which uses 'Sent Items', and server B is a Zimbra server which uses 'Sent'.

Imapsync syntax

The syntax would be as follows, with the <variables> being specific to your given scenario.

Linux # imapsync --host1 <source server> --user1 <source user> --passfile1 ~/.<a file with user1 password> --ssl1 \
--host2 <target server> --user2 <target user> --passfile2 ~/.<a file with user2 password> --ssl2 \
--syncinternaldates --regextrans2 's/<source folder>$/<target folder>/'

Example

A completely fabricated example will look something like the following:

Linux # imapsync --host1 mail.office365.com --user1 user1@mail.office365.com --passfile1 ~/.passfile1 --ssl1 \
--host2 mail.localhost --user2 user2@mail.localhost --passfile2 ~/.passfile2 --ssl2 \
--syncinternaldates --regextrans2 's/Sent Items$/Sent/'

Notes

Being a brief article, it is outside the scope here to explain all of the syntax of imapsync - needless to say it can be very powerful when used with cron jobs etc.

I have specified --passfile options to assist with streamlining the process - this will not ask for a password and ideally should use chmod 600 permissions in a secure location.

--regextrans2 uses regular expression syntax, so either hack the example above or take a quick read

Taking this one step further, if server A had more than one variant of 'Sent' folder, using the following syntax making the most of wildcards will also help tidy things up during your migration:

--regextrans2 's/(.)*Sent(.)*$/Sent/'

Effectively moving sent items from any of server A folders into the single Sent folder on server B.

HTH

Costa-101

Verified Against: Zimbra Collaboration 7.0, 6.0 Date Created: 04/16/2014
Article ID: https://wiki.zimbra.com/index.php?title=Mapping_Folders Date Modified: 2015-07-12



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Jump to: navigation, search