Email Rules Migration

Revision as of 13:38, 31 March 2015 by Jorge de la Cruz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Thunderbird

Try the add-on: Thunderbird Message Filter Import/Export

https://addons.mozilla.org/en-US/thunderbird/addon/2474

Outlook

Note: The ZCS Connector doesn't migrate outlook 2003 mail rules, IIRC from a 200 user migration I did in the past (gettyless 4/26/2009)

.procmailrc

Sieve

You have a few options to migrate Sieve rules. Generally you can take existing rules and then just dump them into the account attribute zimbraMailSieveScript. The server will be able to process these rules. However, if you intend to enable the client to edit the rules you will need to make sure they conform to a ZCS-specific set of characteristics. There are two ways to do this.

Using zmmailbox addFilterRule

Within the zmmailbox command there is a "addFilterRule" command. This allows you to add a named filter to a particular user. Its usage defines the parameters that ZWC can understand for editing. Given that for any migration scenario you'll likely end up parsing the rules, this will let you reconstruct the rules in a syntax ZWC understands. You will need to find a "name" for each rule. It could be as simple as "rule1", "rule2", etc.

Here's the usage for addFilterRule

$ zmmailbox help filter

  addFilterRule(afrl)          [opts] {name}  [*active|inactive] [any|*all] {conditions}+ {actions}+
    -f/--first                   add as first filter rule
    -b/--before <arg>            add before filter-name
    -a/--after <arg>             add after filter-name
    -l/--last                    add as last filter rule

  addOutgoingFilterRule(aofrl) [opts] {name}  [*active|inactive] [any|*all] {conditions}+ {actions}+
    -f/--first                   add as first filter rule
    -b/--before <arg>            add before filter-name
    -a/--after <arg>             add after filter-name
    -l/--last                    add as last filter rule

  deleteFilterRule(dfrl)       {name}

  deleteOutgoingFilterRule(dofrl) {name}

  getFilterRules(gfrl)         

  getOutgoingFilterRules(gofrl) 

  modifyFilterRule(mfrl)       {name} [*active|inactive] [any|*all] {conditions}+ {actions}+

  modifyOutgoingFilterRule(mofrl) {name} [*active|inactive] [any|*all] {conditions}+ {actions}+

  {conditions}:
    address "comma-separated-header-names" all|localpart|domain is|not_is|contains|not_contains|matches|not_matches [case_sensitive] "value"
    addressbook in|not_in "header-name"
    attachment exists|not_exists
    body contains|not_contains [case_sensitive] "text"
    bulk [not]
    conversation where|not_where started|participated
    current_day_of_week is|not_is "comma-separated-days(0=Sun,6=Sat)"
    current_time before|not_before|after|not_after "HHmm"
    date before|not_before|after|not_after "YYYYMMDD"
    facebook [not]
    flagged [not] "flag"
    header "comma-separated-names" is|not_is|contains|not_contains|matches|not_matches [case_sensitive] "value"
    header "comma-separated-names" exists|not_exists
    importance is|not_is high|normal|low
    invite exists|not_exists
    linkedin [not]
    list [not]
    me in|not_in "header-name"
    mime_header "name" is|not_is|contains|not_contains|matches|not_matches [case_sensitive] "value"
    ranking in|not_in "header-name"
    size under|not_under|over|not_over "1|1K|1M"
    socialcast [not]
    twitter [not]

  {actions}:
    keep
    discard
    fileinto "/path"
    tag "tag"
    flag "flag"
    mark read|flagged|priority
    redirect "address"
    reply "body-template"
    notify "address" "subject-template" "body-template" ["max-body-size(bytes)"]
    stop

Also, for add filter rule: mbox> afrl usage:

 addFilterRule(afrl)          [opts] {name}  [*active|inactive] [any|*all] {conditions}+ {actions}+
   -a/--after <arg>             add after filter-name
   -f/--first                   add as first filter rule
   -l/--last                    add as last filter rule
   -b/--before <arg>            add before filter-name


Each zmmailbox script invokes a Java VM (just like zmprov). So you'll want to create a script to be loaded into zmmailbox. That script would look something like
adminAuthenticate ...
selectMailbox user1 ...
addFilterRule rule1 header "from" contains "kevin" discard
addFilterRule rule2 ....
...
selectMailbox user2
addFilterRule ....
...

Then you can run it via zmmailbox < scriptname.

Processing a Sieve script and inserting it via zmprov

Alternately you can process the existing Sieve scripts to conform to ZCS expectations and then insert the whole script via zmprov ma account zimbraMailSieveScript ..... You'll need to restrict the entered rules to the Sieve commands as documented above (if ZWC or ZCO are expected to edit them). Each filter rule will need a comment above it; this comment is the filter's name as identified in addFilterRule. Creating one or two simple rules using the web client will give you a framework for the created rule.

Jump to: navigation, search