Results 1 to 6 of 6

Thread: Adding external accounts from CLI

  1. #1
    Join Date
    Jan 2009
    Rep Power

    Default Adding external accounts from CLI


    My zimbra (5.0.11 NE) domain in ZCS will hold up to 500 accounts. I am not using zcs for mail servers but planning to use the webmail interface of zimbra beacuse for several reasons. Since zcs doesn't allow external imap server access , I am thinking to assign accounts to users using external imap account setup using CLI batch processing.

    The command that I have used assign a external imap account to a user successfully is using the following command. But the problem is after logging into the account i do not see password saved which I have provided in the command.

    Here is the command:


    zmprov cds imap XYZ zimbraDataSourceEmailAddress zimbraDataSourceEnabled TRUE zimbraDataSourceHost zimbraDataSourceUsername parasp zimbraDataSourcePassword test1234 zimbraPrefFromAddress zimbraPrefFromDisplay 'Paras Pradhan' zimbraDataSourceConnectionType ssl zimbraDataSourceFolderId 52121 zimbraDataSourcePort 993


    Also, i will be exporting account information from my non-zimbra ldap master server and use the password field to feed in the above command. so my question is which password data type (md5,ascii) does zmDataSourcePassword supprts and where do i for this info?

    Thanks in adv

  2. #2
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Vannes, France
    Rep Power


    Quote Originally Posted by kathmandu View Post
    Since zcs doesn't allow external imap server access ....
    What does that comment mean? Zimbra is an IMAP server and users can access their Zimbra accounts via IMAP clients, where's the problem with that?


    Acompli: A new adventure for Co-Founder KevinH.

  3. #3
    Join Date
    Jan 2009
    Rep Power


    I am not talking about zimbra's imap server. I am taking about the external imap server or my existing imap servers.


  4. #4
    Join Date
    Apr 2009
    Victoria BC Canada
    Rep Power

    Default Adding external accounts from CLI

    We too are not able to import the password from the external imap server. Perhaps someone at Zimbra has a list of all the attributes for this zmprov cds command Maybe I am using the wrong one

    zmprov cds imap 'First Class' zimbraDataSourceConnectionType cleartext zimbraDataSourceEmailAddress zimbraDataSourceEnabled TRUE zimbraDataSourceHost zimbraDataSourceUsername rpang zimbraDataSourcePassword password zimbraPrefFromAddress zimbraPrefFromDisplay 'Robert Pang' zimbraDataSourceFolderId 2 zimbraDataSourcePort 143

  5. #5
    Join Date
    Oct 2009
    Rep Power

    Question Adding external accounts from CLI zmprov cds problem

    I think there is a problem with CLI command 'zmprov cds' - I will try to explain..

    I have test box with zcs-6.0.3_GA_1915.RHEL5_64.20091118095806 installed, then i have created some test users with passwords from CLI - so far so good..

    After that I decided to connect external account to existing production imap server via Preferences > Accounts > Add External Account - it worked well..

    Now I create same thing with CLI command 'zmprov cds ...' with no error message, but problem appear. There are no folder in users web gui for external account. Preferences > Accounts are filled with correct values. In ldap zimbraDataSourceName container are created and filled with options (including zimbraDataSourcePassword), but there are no row(s) in mysql table in mboxgroup(...).data_source_name with $zimbraDataSourceId, also there are no rows in mboxgroup(...).mail_item with new $zimbraDataSourceName.

    To make things work i need to log in to the user account from web interface, go to Preferences > Accounts mark the account i have created from cli and type the password for that external account > Test Settings > Save > Mail > Get External Mail (in ldap $zimbraDataSourcePassword changes to new one).
    Only after that external mail appear and mysql tables are filled right...

    Is this bug or feature?

  6. #6
    Join Date
    Oct 2009
    Rep Power

    Smile Script to add external accounts from CLI

    Hello again,
    thanks to guys at Zimbra for providing some help to figure all the missing things out. First of all you need zimbraDataSourceFolderId value. You can get it by executing something like this:
    ~]$ zmmailbox -z -m "$email" createFolder -F u /"$exmserv"`
    $email is email and $exmserv is external mail server URL (as folder name). This will create folder and return folder id.
    To add bulk external accounts from CLI I wrote quick and dirty bash script. There is also requirement for userlist.txt - csv file with following fields:
    email,password,display name,givenname,secondname
    This script reads file line by line, splits line into fields then creates folder and adds external account to it. If you want to use this script then correct it to your needs e.g. change or add mail server, add SSL support, change user name etc.

    #!/bin/bash script by akovonklap (c). Add external accounts from CLI
    exec 3< userlist.txt
    while read <&3
    email=`echo "$REPLY"| awk -F, '{print $1}'`
    passwd=`echo "$REPLY"| awk -F, '{print $2}'`
    dispname=`echo "$REPLY"| awk -F, '{print $3}'`
    gname=`echo "$REPLY"| awk -F, '{print $4}'`
    sn=`echo "$REPLY"| awk -F, '{print $5}'`
    exmserv="" #External mail server
    user=`echo "$email"|awk -F@ '{print $1}'`
    zmmailbox -z -m "$email" createFolder -F u /"$exmserv" > /tmp/$exmserv".txt"
    foldid=`cat /tmp/$exmserv".txt"`
    zmprov cds "$email" imap "$exmserv" \
             objectClass zimbraDataSource \
             objectClass zimbraImapDataSource \
             zimbraPrefFromDisplay "$dispname" \
             zimbraPrefReplyToDisplay "$dispname" \
             zimbraDataSourceName "$exmserv" \
             zimbraDataSourceFolderId "$foldid" \
             zimbraDataSourceType imap \
             zimbraDataSourceConnectionType cleartext \
             zimbraDataSourceEnabled TRUE \
             zimbraDataSourceUseAddressForForwardReply TRUE \
             zimbraDataSourceHost "$exmserv" \
             zimbraDataSourceUsername "$user" \
             zimbraDataSourcePassword "$passwd" \
             zimbraPrefFromAddress "$email" \
             zimbraDataSourceEmailAddress "$email" \
             zimbraPrefReplyToAddress "$email" \
             zimbraDataSourcePollingInterval 9m \
             zimbraDataSourcePort 143 \
    rm -f /tmp/$exmserv".txt"
    exit 0
    I Hope this will help to someone..

Similar Threads

    By in forum Installation
    Replies: 4
    Last Post: 06-11-2008, 09:52 AM
  2. Replies: 13
    Last Post: 07-20-2007, 03:21 AM
  3. Is it started or not
    By kwelipatton in forum Installation
    Replies: 10
    Last Post: 03-28-2006, 10:11 PM
  4. Replies: 13
    Last Post: 10-31-2005, 03:22 PM
  5. Replies: 18
    Last Post: 10-30-2005, 08:12 PM

Posting Permissions

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