Results 1 to 1 of 1

Thread: Administrate primary / secondary mail accounts

  1. #1
    Join Date
    Aug 2009
    Location
    The Hague -- The Netherlands
    Posts
    214
    Rep Power
    6

    Lightbulb Administrate primary / secondary mail accounts

    As we noticed since implementing Zimbra 6 months ago, using family mailboxes ( aka secondary mailboxes, aka zimbraChildAccount ) is not very "administrator friendly". There's no way to do it from the webbased admin interface and on the cli you need to type three commands and do some copy/pasting in between. (I know, I'm lazy...). So we cooked up these three simple bash scripts to do the magic for us and thought we'd share them:

    subzim: script subscribes a primary account to a secondary account
    Code:
    #!/bin/bash
    
    WHO=`whoami`
    if [ $WHO != "zimbra" ]
    then
      echo
      echo "Execute this scipt as user zimbra (\"su - zimbra\")"
      echo
      exit 1
    fi
    
    PARAMS=2
    if [ $# -ne "$PARAMS" ]
    then
      echo
      echo "subzim <primary account needing access to> <this secondary account>"
      echo
      exit 1
    fi  
    
    SUBSCRIBER=$1
    MAILBOX=$2
    ID=`zmprov ga $MAILBOX | grep zimbraId: | awk '{print $2}'`
    `zmprov ma $SUBSCRIBER +zimbraChildAccount $ID`
    `zmprov ma $SUBSCRIBER +zimbraPrefChildVisibleAccount $ID`
    unsubzim: unsubsribes a primary account from a secondary account
    Code:
    #!/bin/bash
    
    WHO=`whoami`
    if [ $WHO != "zimbra" ]
    then
      echo
      echo "Execute this scipt as user zimbra (\"su - zimbra\")"
      echo
      exit 1
    fi
    
    PARAMS=2
    if [ $# -ne "$PARAMS" ]
    then
      echo
      echo "unsubzim <primary account> < from this secondary account>"
      echo
      exit 1
    fi
    
    SUBSCRIBER=$1
    MAILBOX=$2
    ID=`zmprov ga $MAILBOX | grep zimbraId: | awk '{print $2}'`
    `zmprov ma $SUBSCRIBER -zimbraChildAccount $ID`
    `zmprov ma $SUBSCRIBER -zimbraPrefChildVisibleAccount $ID`
    sublist Lists primary accounts having access to a secondary account
    Code:
    #!/bin/bash
    
    WHO=`whoami`
    if [ $WHO != "zimbra" ]
    then
      echo
      echo "Execute this scipt as user zimbra (\"su - zimbra\")"
      echo
      exit 1
    fi
    
    PARAMS=1
    if [ $# -ne "$PARAMS" ]
    then
      echo
      echo "sublist <secondary account to list subscribed primary accounts for>"
      echo
      exit 1
    fi 
    
    id=`zmprov ga $1 | grep zimbraId: | awk '{print $2}'`
    list=`zmprov sa zimbraChildAccount=$id`
    echo $list
    Hope it's useful for you! It's been saving us lot's of work
    Last edited by Hivos; 03-09-2010 at 05:49 AM.

Similar Threads

  1. Mail deferred with Connection timed out
    By Miklos Kalman in forum Administrators
    Replies: 7
    Last Post: 11-17-2012, 05:11 AM
  2. Replies: 7
    Last Post: 02-03-2011, 06:01 AM
  3. [SOLVED] mailbox and apache not running
    By rtwick in forum Administrators
    Replies: 4
    Last Post: 11-15-2008, 07:21 AM
  4. Replies: 20
    Last Post: 03-18-2008, 05:37 AM
  5. Mail not getting to mail boxes
    By ehults in forum Installation
    Replies: 5
    Last Post: 10-31-2005, 08:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •