Zmmailbox

Zmmailbox

   KB 1784        Last updated on 2015-07-13  




0.00
(0 votes)

Intro

zmmailbox requires version ZCS 4.0+

In the world of Zimbra permissions and sharing -- everything (calendars, briefcase, chat, etc) is a folder.

Command Usage

zmmailbox [args] [cmd] [cmd-args ...]

 -h/--help                                display this usage
 -f/--file                                use file as input stream
 -u/--url      http[s]://{host}[:{port}]  server hostname and optional port. must use admin port with -z/-a
 -a/--admin    {name}                     admin account name to auth as
 -z/--zadmin                              use zimbra admin name/password from localconfig for admin/password
 -y/--authtoken {authtoken}               use auth token string(has to be in JSON format) from command line
 -Y/--authtokenfile {authtoken file}      use auth token string(has to be in JSON format) from command line
 -m/--mailbox  {name}                     mailbox to open
 -p/--password {pass}                     password for admin account and/or mailbox
 -P/--passfile {file}                     read password from file
 -r/--protocol {proto|req-proto/response-proto} specify request/response protocol [soap11,soap12,json]
 -v/--verbose                             verbose mode (dumps full exception stack trace)
 -d/--debug                               debug mode (dumps SOAP messages)
    zmmailbox help admin           help on admin-related commands
    zmmailbox help account         help on account-related commands
    zmmailbox help appointment     help on appoint-related commands
    zmmailbox help commands        help on all commands
    zmmailbox help contact         help on contact-related commands
    zmmailbox help conversation    help on conversation-related commands
    zmmailbox help filter          help on filter-realted commnds
    zmmailbox help folder          help on folder-related commands
    zmmailbox help item            help on item-related commands
    zmmailbox help message         help on message-related commands
    zmmailbox help misc            help on misc commands
    zmmailbox help right           help on right commands
    zmmailbox help search          help on search-related commands
    zmmailbox help tag             help on tag-related commands

Help Usage

zmmailbox help admin

 adminAuthenticate(aa)        [opts] {admin-name} {admin-password}
   -u/--url <arg>               url to connect to
 selectMailbox(sm)            [opts] {name}
   -A/--admin-priv              execute requests with admin privileges
   --auth <arg>                 account to auth as

zmmailbox help account

 createIdentity(cid)          {identity-name} [attr1 value1 [attr2 value2...]]
 createSignature(csig)        {signature-name} [signature-value}
 deleteIdentity(did)          {identity-name}
 deleteSignature(dsig)        {signature-name|signature-id}
 getIdentities(gid)           [opts] 
   -v/--verbose                 verbose output
 getSignatures(gsig)          [opts] 
   -v/--verbose                 verbose output
 modifyIdentity(mid)          {identity-name} [attr1 value1 [attr2 value2...]]
 modifySignature(msig)        {signature-name|signature-id} {value}
 renameSignature(rsig)        {signature-name|signature-id} {new-name}

zmmailbox help appointment

 getAppointmentSummaries(gaps) [opts] {start-date-spec} {end-date-spec} {folder-path}
   -v/--verbose                 verbose output
absolute date-specs:
 mm/dd/yyyy (i.e., 12/25/1998)
 yyyy/dd/mm (i.e., 1989/12/25)
 \d+       (num milliseconds, i.e., 1132276598000)
 relative date-specs:
 [mp+-]?([0-9]+)([mhdwy][a-z]*)?g

  +/{not-specified}   current time plus an offset
  -                   current time minus an offset
 
  (0-9)+    value
  ([mhdwy][a-z]*)  units, everything after the first character is ignored (except for "mi" case):
  m(onths)
  mi(nutes)
  d(ays)
  w(eeks)
  h(ours)
  y(ears)
  
 examples:
    1day     1 day from now
   +1day     1 day from now 
   p1day     1 day from now
   +60mi     60 minutes from now
   +1week    1 week from now
   +6mon     6 months from now 
   1year     1 year from now

zmmailbox help commands

 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
 addMessage(am)               [opts] {dest-folder-path} {filename-or-dir} [{filename-or-dir} ...]
   -T/--tags <arg>              list of tag ids/names
   -F/--flags <arg>             flags
   -d/--date <arg>              received date (msecs since epoch)
   --noValidation               don't validate file content
 adminAuthenticate(aa)        [opts] {admin-name} {admin-password}
   -u/--url <arg>               url to connect to
 authenticate(a)              [opts] {auth-account-name} {password} [target-account-name]
   -u/--url <arg>               url to connect to
 autoComplete(ac)             [opts] {query}
   -v/--verbose                 verbose output
 autoCompleteGal(acg)         [opts] {query}
   -v/--verbose                 verbose output
 checkRight(ckr)              [opts] {name} {right}
   -v/--verbose                 verbose output
 createContact(cct)           [opts] [attr1 value1 [attr2 value2...]]
   -f/--folder <arg>            folder-path-or-id
   -T/--tags <arg>              list of tag ids/names
   -i/--ignore                  ignore unknown contact attrs
 createFolder(cf)             [opts] {folder-path}
   -u/--url <arg>               url to connect to
   -F/--flags <arg>             flags
   -V/--view <arg>              default type for folder (appointment,contact,conversation,document,message,task,wiki)
   -c/--color <arg>             color
 createIdentity(cid)          {identity-name} [attr1 value1 [attr2 value2...]]
 createMountpoint(cm)         [opts] {folder-path} {owner-id-or-name} {remote-item-id-or-path} [{reminder-enabled (0*|1)}]
   -F/--flags <arg>             flags
   -V/--view <arg>              default type for folder (appointment,contact,conversation,document,message,task,wiki)
   -c/--color <arg>             color
 createSearchFolder(csf)      [opts] {folder-path} {query}
   -t/--types <arg>             list of types to search for (message,conversation,contact,appointment,document,task,wiki)
   -s/--sort <arg>              sort order TODO
   -c/--color <arg>             color
 createSignature(csig)        {signature-name} [signature-value}
 createTag(ct)                [opts] {tag-name}
   -c/--color <arg>             color
 deleteContact(dct)           {contact-ids}
 deleteConversation(dc)       {conv-ids}
 deleteItem(di)               {item-ids}
 deleteIdentity(did)          {identity-name}
 deleteFilterRule(dfrl)       {name}
 deleteOutgoingFilterRule(dofrl) {name}
 deleteFolder(df)             {folder-path}
 deleteMessage(dm)            {msg-ids}
 deleteSignature(dsig)        {signature-name|signature-id}
 deleteTag(dt)                {tag-name}
 dumpsterDeleteItem(ddi)      {item-ids}
 emptyDumpster                
 emptyFolder(ef)              {folder-path}
 exit(quit)                   
 flagContact(fct)             {contact-ids} [0|1*]
 flagConversation(fc)         {conv-ids} [0|1*]
 flagItem(fi)                 {item-ids} [0|1*]
 flagMessage(fm)              {msg-ids} [0|1*]
 getAllContacts(gact)         [opts] [attr1 [attr2...]]
   -f/--folder <arg>            folder-path-or-id
   -v/--verbose                 verbose output
 getAllFolders(gaf)           [opts] 
   -v/--verbose                 verbose output
 getAllTags(gat)              [opts] 
   -v/--verbose                 verbose output
 getAppointmentSummaries(gaps) [opts] {start-date-spec} {end-date-spec} {folder-path}
   -v/--verbose                 verbose output
 getContacts(gct)             [opts] {contact-ids} [attr1 [attr2...]]
   -v/--verbose                 verbose output
 getConversation(gc)          [opts] {conv-id}
   -v/--verbose                 verbose output
 getIdentities(gid)           [opts] 
   -v/--verbose                 verbose output
 getFilterRules(gfrl)         
 getOutgoingFilterRules(gofrl) 
 getFolder(gf)                [opts] {folder-path}
   -v/--verbose                 verbose output
 getFolderRequest(gfr)        [opts] {folder-id}
   -v/--verbose                 verbose output
 getFolderGrant(gfg)          [opts] {folder-path}
   -v/--verbose                 verbose output
 getMessage(gm)               [opts] {msg-id}
   -v/--verbose                 verbose output
 getMailboxSize(gms)          [opts] 
   -v/--verbose                 verbose output
 getRights(gr)                [opts] [right1 [right2...]]
   -v/--verbose                 verbose output
 getRestURL(gru)              [opts] {relative-path}
   --startTime <arg>            start time for ics export
   -u/--url <arg>               url to connect to
   -o/--output <arg>            output filename
   --endTime <arg>              end time for ics export
 getSignatures(gsig)          [opts] 
   -v/--verbose                 verbose output
 grantRight(grr)              {account {name}|group {name}|domain {name}||all|public|guest {email} [{password}]|key {email} [{accesskey}] {[-]right}}
 help(?)                      [opts] commands
   -v/--verbose                 verbose output
 importURLIntoFolder(iuif)    {folder-path} {url}
 listRights(lr)               [opts] 
   -v/--verbose                 verbose output
 markConversationRead(mcr)    {conv-ids} [0|1*]
 markConversationSpam(mcs)    {conv} [0|1*] [{dest-folder-path}]
 markItemRead(mir)            {item-ids} [0|1*]
 markFolderRead(mfr)          {folder-path}
 markMessageRead(mmr)         {msg-ids} [0|1*]
 markMessageSpam(mms)         {msg} [0|1*] [{dest-folder-path}]
 markTagRead(mtr)             {tag-name}
 modifyContactAttrs(mcta)     [opts] {contact-id} [attr1 value1 [attr2 value2...]]
   -r/--replace                 replace contact (default is to merge)
   -i/--ignore                  ignore unknown contact attrs
 modifyFilterRule(mfrl)       {name} [*active|inactive] [any|*all] {conditions}+ {actions}+
 modifyOutgoingFilterRule(mofrl) {name} [*active|inactive] [any|*all] {conditions}+ {actions}+
 modifyFolderChecked(mfch)    {folder-path} [0|1*]
 modifyFolderColor(mfc)       {folder-path} {new-color}
 modifyFolderExcludeFreeBusy(mfefb) {folder-path} [0|1*]
 modifyFolderFlags(mff)       {folder-path} {folder-flags}
 modifyFolderGrant(mfg)       {folder-path} {account {name}|group {name}|cos {name}|domain {name}|all|public|guest {email}|key {email} [{accesskey}] {permissions|none}}
 modifyFolderURL(mfu)         {folder-path} {url}
 modifyIdentity(mid)          {identity-name} [attr1 value1 [attr2 value2...]]
 modifyItemFlags(mif)         {item-ids} {item-flags}
 modifyMountpointEnableSharedReminder(mmesr) {mountpoint-path} {0|1}
 modifySignature(msig)        {signature-name|signature-id} {value}
 modifyTagColor(mtc)          {tag-name} {tag-color}
 moveContact(mct)             {contact-ids} {dest-folder-path}
 moveConversation(mc)         {conv-ids} {dest-folder-path}
 moveItem(mi)                 {item-ids} {dest-folder-path}
 moveMessage(mm)              {msg-ids} {dest-folder-path}
 noOp(no)                     
 postRestURL(pru)             [opts] {relative-path} {file-name}
   -u/--url <arg>               url to connect to
   --preserveAlarms             preserve existing calendar alarms during ics import (default is to use alarms in ics file)
   -c/--contentType <arg>       content-type
   -i/--ignore                  ignore and continue on error during ics import
 recoverItem(ri)              {item-ids} {dest-folder-path}
 renameFolder(rf)             {folder-path} {new-folder-path}
 renameSignature(rsig)        {signature-name|signature-id} {new-name}
 renameTag(rt)                {tag-name} {new-tag-name}
 revokeRight(rvr)             {account {name}|group {name}|domain {name}||all|public|guest {email} [{password}]|key {email} [{accesskey}] {[-]right}}
 search(s)                    [opts] {query}
   -v/--verbose                 verbose output
   -t/--types <arg>             list of types to search for (message,conversation,contact,appointment,document,task,wiki)
   -s/--sort <arg>              sort order TODO
   -c/--current                 current page of search results
   --dumpster                   search in dumpster
   -p/--previous                previous page of search results
   -n/--next                    next page of search results
   -l/--limit <arg>             max number of results to return (1-1000, default=25)
 searchConv(sc)               [opts] {conv-id} {query}
   -v/--verbose                 verbose output
   -t/--types <arg>             list of types to search for (message,conversation,contact,appointment,document,task,wiki)
   -s/--sort <arg>              sort order TODO
   -c/--current                 current page of search results
   -p/--previous                previous page of search results
   -n/--next                    next page of search results
   -l/--limit <arg>             max number of results to return (1-1000, default=25)
 selectMailbox(sm)            [opts] {name}
   -A/--admin-priv              execute requests with admin privileges
   --auth <arg>                 account to auth as
 syncFolder(sf)               {folder-path}
 tagContact(tct)              {contact-ids} {tag-name} [0|1*]
 tagConversation(tc)          {conv-ids} {tag-name} [0|1*]
 tagItem(ti)                  {item-ids} {tag-name} [0|1*]
 tagMessage(tm)               {msg-ids} {tag-name} [0|1*]
 whoami

zmmailbox help contact

 autoComplete(ac)             [opts] {query}
   -v/--verbose                 verbose output
 autoCompleteGal(acg)         [opts] {query}
   -v/--verbose                 verbose output
 createContact(cct)           [opts] [attr1 value1 [attr2 value2...]]
   -f/--folder <arg>            folder-path-or-id
   -T/--tags <arg>              list of tag ids/names
   -i/--ignore                  ignore unknown contact attrs
 deleteContact(dct)           {contact-ids}
 flagContact(fct)             {contact-ids} [0|1*]
 getAllContacts(gact)         [opts] [attr1 [attr2...]]
   -f/--folder <arg>            folder-path-or-id
   -v/--verbose                 verbose output
 getContacts(gct)             [opts] {contact-ids} [attr1 [attr2...]]
   -v/--verbose                 verbose output
 modifyContactAttrs(mcta)     [opts] {contact-id} [attr1 value1 [attr2 value2...]]
   -r/--replace                 replace contact (default is to merge)
   -i/--ignore                  ignore unknown contact attrs
 moveContact(mct)             {contact-ids} {dest-folder-path}
 tagContact(tct)              {contact-ids} {tag-name} [0|1*]

zmmailbox help conversation

 deleteConversation(dc)       {conv-ids}
 flagConversation(fc)         {conv-ids} [0|1*]
 getConversation(gc)          [opts] {conv-id}
   -v/--verbose                 verbose output
 markConversationRead(mcr)    {conv-ids} [0|1*]
 markConversationSpam(mcs)    {conv} [0|1*] [{dest-folder-path}]
 moveConversation(mc)         {conv-ids} {dest-folder-path}
 tagConversation(tc)          {conv-ids} {tag-name} [0|1*]

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

zmmailbox help folder

 createFolder(cf)             [opts] {folder-path}
   -u/--url <arg>               url to connect to
   -F/--flags <arg>             flags
   -V/--view <arg>              default type for folder (appointment,contact,conversation,document,message,task,wiki)
   -c/--color <arg>             color
 createMountpoint(cm)         [opts] {folder-path} {owner-id-or-name} {remote-item-id-or-path} [{reminder-enabled (0*|1)}]
   -F/--flags <arg>             flags
   -V/--view <arg>              default type for folder (appointment,contact,conversation,document,message,task,wiki)
   -c/--color <arg>             color
 createSearchFolder(csf)      [opts] {folder-path} {query}
   -t/--types <arg>             list of types to search for (message,conversation,contact,appointment,document,task,wiki)
   -s/--sort <arg>              sort order TODO
   -c/--color <arg>             color
 deleteFolder(df)             {folder-path}
 emptyFolder(ef)              {folder-path}
 getAllFolders(gaf)           [opts] 
   -v/--verbose                 verbose output
 getFolder(gf)                [opts] {folder-path}
   -v/--verbose                 verbose output
 getFolderRequest(gfr)        [opts] {folder-id}
   -v/--verbose                 verbose output
 getFolderGrant(gfg)          [opts] {folder-path}
   -v/--verbose                 verbose output
 importURLIntoFolder(iuif)    {folder-path} {url}
 markFolderRead(mfr)          {folder-path}
 modifyFolderChecked(mfch)    {folder-path} [0|1*]
 modifyFolderColor(mfc)       {folder-path} {new-color}
 modifyFolderExcludeFreeBusy(mfefb) {folder-path} [0|1*]
 modifyFolderFlags(mff)       {folder-path} {folder-flags}
 modifyFolderGrant(mfg)       {folder-path} {account {name}|group {name}|cos {name}|domain {name}|all|public|guest {email}|key {email} [{accesskey}] {permissions|none}}
 modifyFolderURL(mfu)         {folder-path} {url}
 modifyMountpointEnableSharedReminder(mmesr) {mountpoint-path} {0|1}
 renameFolder(rf)             {folder-path} {new-folder-path}
 syncFolder(sf)               {folder-path}

zmmailbox help item

 deleteItem(di)               {item-ids}
 dumpsterDeleteItem(ddi)      {item-ids}
 flagItem(fi)                 {item-ids} [0|1*]
 markItemRead(mir)            {item-ids} [0|1*]
 modifyItemFlags(mif)         {item-ids} {item-flags}
 moveItem(mi)                 {item-ids} {dest-folder-path}
 recoverItem(ri)              {item-ids} {dest-folder-path}
 tagItem(ti)                  {item-ids} {tag-name} [0|1*]

zmmailbox help message

 addMessage(am)               [opts] {dest-folder-path} {filename-or-dir} [{filename-or-dir} ...]
   -T/--tags <arg>              list of tag ids/names
   -F/--flags <arg>             flags
   -d/--date <arg>              received date (msecs since epoch)
   --noValidation               don't validate file content
 deleteMessage(dm)            {msg-ids}
 flagMessage(fm)              {msg-ids} [0|1*]
 getMessage(gm)               [opts] {msg-id}
   -v/--verbose                 verbose output
 markMessageRead(mmr)         {msg-ids} [0|1*]
 markMessageSpam(mms)         {msg} [0|1*] [{dest-folder-path}]
 moveMessage(mm)              {msg-ids} {dest-folder-path}
 tagMessage(tm)               {msg-ids} {tag-name} [0|1*]

zmmailbox help misc

 authenticate(a)              [opts] {auth-account-name} {password} [target-account-name]
   -u/--url <arg>               url to connect to
 emptyDumpster                
 exit(quit)                   
 getMailboxSize(gms)          [opts] 
   -v/--verbose                 verbose output
 getRestURL(gru)              [opts] {relative-path}
   --startTime <arg>            start time for ics export
   -u/--url <arg>               url to connect to
   -o/--output <arg>            output filename
   --endTime <arg>              end time for ics export
 help(?)                      [opts] commands
   -v/--verbose                 verbose output
 noOp(no)                     
 postRestURL(pru)             [opts] {relative-path} {file-name}
   -u/--url <arg>               url to connect to
   --preserveAlarms             preserve existing calendar alarms during ics import (default is to use alarms in ics file)
   -c/--contentType <arg>       content-type
   -i/--ignore                  ignore and continue on error during ics import
 whoami

zmmailbox help right

 checkRight(ckr)              [opts] {name} {right}
   -v/--verbose                 verbose output
 getRights(gr)                [opts] [right1 [right2...]]
   -v/--verbose                 verbose output
 grantRight(grr)              {account {name}|group {name}|domain {name}||all|public|guest {email} [{password}]|key {email} [{accesskey}] {[-]right}}
 listRights(lr)               [opts] 
   -v/--verbose                 verbose output
 revokeRight(rvr)             {account {name}|group {name}|domain {name}||all|public|guest {email} [{password}]|key {email} [{accesskey}] {[-]right}}
To grant/revoke rights on entries an account can inherit grants from(group, domain, global), use "zmprov grr/rvr" commands.

zmmailbox help search

 search(s)                    [opts] {query}
   -v/--verbose                 verbose output
   -t/--types <arg>             list of types to search for (message,conversation,contact,appointment,document,task,wiki)
   -s/--sort <arg>              sort order TODO
   -c/--current                 current page of search results
   --dumpster                   search in dumpster
   -p/--previous                previous page of search results
   -n/--next                    next page of search results
   -l/--limit <arg>             max number of results to return (1-1000, default=25)
 searchConv(sc)               [opts] {conv-id} {query}
   -v/--verbose                 verbose output
   -t/--types <arg>             list of types to search for (message,conversation,contact,appointment,document,task,wiki)
   -s/--sort <arg>              sort order TODO
   -c/--current                 current page of search results
   -p/--previous                previous page of search results
   -n/--next                    next page of search results
   -l/--limit <arg>             max number of results to return (1-1000, default=25)

zmmailbox help tag

 createTag(ct)                [opts] {tag-name}
   -c/--color <arg>             color
 deleteTag(dt)                {tag-name}
 getAllTags(gat)              [opts] 
   -v/--verbose                 verbose output
 markTagRead(mtr)             {tag-name}
 modifyTagColor(mtc)          {tag-name} {tag-color}
 renameTag(rt)                {tag-name} {new-tag-name}

Examples

Creating a Filter Rule

If you want to create a Filter Rule based, for example, in the Subject, here is the command:

zmmailbox -z -m account@domain.com addFilterRule 'NAME OF FILTER' active any header 'subject' contains 'WORD O WORDS THAT YOU WANT FILTER' fileinto "/Junk"

Determining Mailbox Size

To find the mailbox size for user@domain.com

zmmailbox -z -m user@domain.com gms

You can also get this from zmprov, per server:

zmprov gqu `zmhostname`|awk {'print " "$3" "$2" "$1'}

View all folders for a User

zmmailbox -z -m admin@example.com gaf:

        Id  View      Unread   Msg Count  Path
----------  ----  ----------  ----------  ----------
         1  conv           0           0  /
        16  docu           0           0  /Briefcase
        10  appo           0           0  /Calendar
        14  mess           0           0  /Chats
         7  cont           0           0  /Contacts
         6  mess           0           0  /Drafts
        13  cont           0           0  /Emailed Contacts
         2  mess           1           1  /Inbox
         4  mess           0           0  /Junk
        12  wiki           0           0  /Notebook
         5  mess           0           0  /Sent
        15  task           0           0  /Tasks
         3  conv           0           0  /Trash

View all folders and folder permissions for a User

This is the same as above, but with -v: zmmailbox -z -m admin@example.com gaf -v:

{
     "children": [
          {
               "children": [],
               "color": "defaultColor",
               "grants": [],
               "id": "16",
               "messageCount": 0,
               "name": "Briefcase",
               "parentId": "1",
               "path": "/Briefcase",
               "unreadCount": 0,
               "view": "document"
          },
          {
               "children": [],
               "color": "defaultColor",
               "flags": "#",
               "grants": [],
               "id": "10",
               "messageCount": 0,
               "name": "Calendar",
               "parentId": "1",
               "path": "/Calendar",
               "unreadCount": 0,
               "view": "appointment"
          },
          {
               "children": [],
               "color": "defaultColor",
               "grants": [],
               "id": "14",
               "messageCount": 0,
               "name": "Chats",
               "parentId": "1",
               "path": "/Chats",
               "unreadCount": 0,
               "view": "message"
          },
          {
               "children": [],
               "color": "defaultColor",
               "grants": [],
               "id": "7",
               "messageCount": 0,
               "name": "Contacts",
               "parentId": "1",
               "path": "/Contacts",
               "unreadCount": 0,
               "view": "contact"
          },
... ... ...
... ... ...
... ... ...
... ... ...

Export/import an entire account

This is a particularly useful tool if you plan to script exporting and importing data. This can be used to export an account from one Zimbra ZCS platform, and imported to another. When exporting/importing large mailboxes, it is important to set the timeout to "0" (infinity):

You can export an entire mailbox with:

/opt/zimbra/bin/zmmailbox -z -m user@domain.com -t 0 getRestURL “//?fmt=tgz” > /tmp/account.tgz

Next transfer the tgz file to the destination ZCS platform via rsync, scp, sftp, etc. You’ll also need to create the account on the second server if the desired account doesn’t exist at your destination server yet.

Then import with:

/opt/zimbra/bin/zmmailbox -z -m user@domain.com -t 0 postRestURL “//?fmt=tgz&resolve=reset”  /tmp/account.tgz

The resolve= parameter has several options:

   “skip” ignores duplicates of old items, it’s also the default conflict-resolution.
   “modify” changes old items.
   “reset” will delete the old subfolder (or entire mailbox if /).
   “replace” will delete and re-enter them.

‘Reset’ will be a bit faster on an empty destination mailbox because it skips most dupe checks.

Import messages from an existing Maildir into the INBOX folder

echo addMessage /INBOX /path/to/Maildir/cur | /opt/zimbra/bin/zmmailbox -z -m foo@bar.com

Sharing

Sharing is combination of providing access & actually mapping a folder to the share.

Permissions (modifyFolderGrant)

zmmailbox -z -m share@domain.com mfg /Calendar account user@domain.com r

You could do any of the following for modifyFolderGrant [account {name}|group {name}|domain {name}|all|public|guest {email} [{password}]|key {email} [{accesskey}] {permissions|none}} followed by the permissions like: r, rw, rwix, rwixd, rwixda, none.

  • (r)ead - search, view overviews and items
  • (w)rite - edit drafts/contacts/notes, set flags
  • (i)nsert - copy/add to directory, create subfolders action
  • (x) - workflow actions, like accepting appointments
  • (d)elete - delete items and subfolders, set \Deleted flag
  • (a)dminister - delegate admin and change permissions

Mounting (createMountPoint)

Folder mount points for shared folders can be created on the command line to be accessed in the web interface. Currently, the mount points are not downloaded by the ZCO or iSync connectors and therefore must be designated manually in your 3rd party mail client, i.e., Outlook. They will show up as folders you can subscribe to in IMAP clients once you mount.

zmmailbox -z -m user@domain.com cm --view appointment -F# /sharedcal share@domain.com /Calendar

View types are appointment, contact, conversation, document, message, task, wiki.

Note When mounting a calendar to a user (--view appointment), the calendar will be added disabled or "unticked" to the user. To make sure the calendar is enabled when mounting, add -F# to the command line.

Options for mountpoints as described in the /opt/zimbra/docs/soap.txt [ZCS 8.0.6] :

  {folder-name}  = name of folder
  {parent-id}    = id of parent folder (absent for root folder)
  {flags}        = checked in UI (#), exclude free/(b)usy info, IMAP subscribed (*)
  {owner's-display-name} = primary email address of the owner of the linked-to resource
  {owner's-zimbra-id} = Zimbra id (guid) of the owner of the linked-to resource
  {id-of-shared-item} = item id of the linked-to resource in the remote mailbox
  {UUID-of-shared-item} = UUID of the linked-to resource in the remote mailbox
  {owner's-name-for-item} = The name presently used for the item by the owner
  {color}        = numeric; range 0-127; defaults to 0 if not present; client can display only 0-7
  {default-type} = (optional) default type for the folder; used by web client to decide which view to use;
                   possible values are the same as <SearchRequest>'s {types}:
                   conversation|message|contact|appointment|task|etc
  {reminder-enabled} = whether client should display reminder for appointments/tasks on this shared calendar

Sharing the entirety of an account

While you could manually do each & specify view, it will auto-detect if you leave it off, thus you can quickly share the entire account:

zmmailbox -z -m share@domain.com mfg / account user@domain.com rwixd
zmmailbox -z -m user@domain.com cm /shared share@domain.com /

Another method for sharing everything (just for the AJAX web client & not HTML client yet or other clients like IMAP): Mailboxes: Sharing vs. Relationships » Zimbra :: Blog

Walkthrough

In this example, the administrator wishes to designate a mount point to alice@domain.com for the shared marketing calendar located in the marketing@domain.com account for which she will have read/write permissions.

 $ zmmailbox
 mbox> adminAuthenticate -u https://server.domain.com:7071 admin@domain.com password 
 mbox> selectMailbox marketing@domain.com
 mailbox: marketing@domain.com, size: 100.12 MB, messages: 1010, unread: 11
 mbox marketing@domain.com> getAllFolders
         Id  View      Unread   Msg Count  Path
 ----------  ----  ----------  ----------  ----------
          1  conv           0           0  /
         10  appo           0           0  /Calendar
         14  mess           0           0  /Chats
          7  cont           0           0  /Contacts
        720  mess           0           0  /Deleted Messages
          6  mess           0           0  /Drafts
          2  mess          11        1010  /Inbox
        901  conv           0           0  /Journal
          4  mess           0           0  /Junk
         12  wiki           0           0  /Notebook
        900  conv           0           0  /Outbox
          5  mess           0           0  /Sent
         15  task           0           0  /Tasks
          3  conv           0           0  /Trash

 mbox marketing@domain.com> getFolderGrant /Calendar
 Inherit  Permissions    Type  Display
 -------  -----------  ------  -------
   false        rwidx  accoun  null 
 mbox marketing@domain.com> modifyFolderGrant /Calendar account alice@domain.com rw

 mbox marketing@domain.com> gfg /Calendar
 Inherit  Permissions    Type  Display
 -------  -----------  ------  -------
   false        rwidx  accoun  null 
   false           rw  accoun  alice@domain.com

 mbox marketing@domain.com> selectMailbox alice@domain.com
 mailbox: alice@domain.com, size: 251.32 MB, messages: 1543, unread: 314

 mbox alice@domain.com> createMountpoint --view appointment /marketing-calendar marketing@domain.com /Calendar
 2342

The following command line options will perform the equivalent action to a user "albert" sharing their Calendar to another user "brian":

zmmailbox -z -m albert@example.com mfg -i /Calendar account brian@example.com none      "Permission: None"
zmmailbox -z -m albert@example.com mfg -i /Calendar account brian@example.com r         "Permission: Viewer"
zmmailbox -z -m albert@example.com mfg -i /Calendar account brian@example.com rwidx     "Permission: Manager"

Note that the last option uses "rwidx", not just "rw".

Inheriting Rights

In 5.0.x we removed the -i "Inherit" flag from folder grants and subfolder permission inheritance is now always TRUE.

To prevent inheriting you must share the parent folder, then unshare each of the children by setting an explicit ACL on each of them.

If you attempt to reshare the subfolders following this, you may need to clear the -i flag. See Clearing the "don't inherit grants from parent folder"(i) flag for more information on how to clear this flag.


Reasoning:

Back when we had the -i inherited/not-inherited bit on the grant rather than on the folder, there was no way to tell whether you could effectively create a subfolder within a shared folder. In order for subfolder creation to be really workable, you need insert rights on the parent folder (to create the subfolder) and read rights on the created folder (to see the subfolder you just created). But under the old regime, the simple set of effective perms on the parent folder wasn't enough. You could tell that you had read rights *on the parent* but not whether those read rights would carry over to the child folder. So we added the calculated "c" right that meant that you could create a subfolder and then see it.

Under the new ACL model, this isn't a problem. Folders inherit the full ACL, so if you have read and insert on the parent folder then you're going to have read and insert on any subfolder you create. Now the client can just look for "r" and "i" in the shared parent's perms. If they're present, they can create a visible subfolder.

Which means that we could get rid of the calculated "c" right for 6.0.

Share Notices

RFE for -n to send a share notice when used on modifyFolderGrant bug 34283

Scripting

Using -f For File Input

Let's say you want to create thousands of folders for testing purposes. Here's a walk through on doing that.

First, create a root folder:

zmmailbox -z -m USER@DOMAIN cf -V message /Large-Share

Now, create a file we'll use for zmmailbox's input.

for i in {1..5300}; do echo "cf -V message /Large-Share/Folder$i" >> /tmp/create-folder ; done

This will give us something like:

cf -V message /Large-Share/Folder1
cf -V message /Large-Share/Folder2
cf -V message /Large-Share/Folder3
cf -V message /Large-Share/Folder4
cf -V message /Large-Share/Folder5
cf -V message /Large-Share/Folder6
cf -V message /Large-Share/Folder7
cf -V message /Large-Share/Folder8
cf -V message /Large-Share/Folder9
cf -V message /Large-Share/Folder10

...

cf -V message /Large-Share/Folder5291
cf -V message /Large-Share/Folder5292
cf -V message /Large-Share/Folder5293
cf -V message /Large-Share/Folder5294
cf -V message /Large-Share/Folder5295
cf -V message /Large-Share/Folder5296
cf -V message /Large-Share/Folder5297
cf -V message /Large-Share/Folder5298
cf -V message /Large-Share/Folder5299
cf -V message /Large-Share/Folder5300

Now we can feed in the commands with zmmailbox with the -f option.

zmmailbox -z -m USER@DOMAIN -f /tmp/create-folder

The method above is A LOT faster than using a for loop against the zmmailbox command itself. Invoking separate zmmailbox commands causes undue delay. Example, where one does:

for i in {1..5300}; do zmmailbox -z -m USER@DOMAIN cf -V message /Large-Share/Folder$i ; done
Jump to: navigation, search