Results 1 to 7 of 7

Thread: Maildir to Zimbra

Threaded View

  1. #1
    Join Date
    May 2007
    Posts
    63
    Rep Power
    8

    Default Maildir to Zimbra

    This is a modification of the Maildir import script on the Wiki. It copies the messages to the correct folder on Zimbra, it also will copy folder names with spaces in them, and I've joined the cur/new folder stuff into one loop, rather then two. I've also exempted creation of certain mailboxes that exist within zimbra by default to avoid zmmailbox error delay's.

    I'm not a proficient bash coder, so if there is major issues with it please let me know. I've migrated about 300GB with it, without issue.

    One thing that it doesn't do is set the flags, I haven't quite figured out how to do that with zmmailbox/zimbra yet. I know I can do it with imapsync, but I'd rather do it from the same script.


    #!/bin/bash

    #
    # Maildir to Zimbra import
    # Drop in your user root and run as superuser.
    #

    domain="domain.com" # change to your domain!

    for user in `ls -d1 */|sed s/\\\///`
    do
    echo
    echo "User $user"
    echo
    #
    #
    find $user -maxdepth 10 -type d -name cur | while read line;
    do
    folder=`echo ${line}|cut -f3 -d"/"|sed s/\\\.//`
    line2=`echo ${line/%cur/new}`
    echo "FOLDER $folder"
    if [ "$folder" = "cur" ]
    then
    /opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage Inbox $PWD/$user/.maildir/cur
    /opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage Inbox $PWD/$user/.maildir/new
    else
    if [ "$folder" != "Sent" ] && [ "$folder" != "Drafts" ] && [ "$folder" != "Junk" ] && [ "$folder" != "Trash" ]
    then
    /opt/zimbra/bin/zmmailbox -z -m $user@$domain createFolder "/$folder"
    fi
    /opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "/$folder" "${PWD}/${line}"
    /opt/zimbra/bin/zmmailbox -z -m $user@$domain addMessage "/$folder" "${PWD}/${line2}"
    fi
    done

    done
    Last edited by drwho18; 11-30-2008 at 04:35 AM.

Similar Threads

  1. slapd message error
    By smoke in forum Administrators
    Replies: 7
    Last Post: 04-27-2008, 03:23 PM
  2. admin consol blank after 5.0.3 upgarde
    By maumar in forum Administrators
    Replies: 6
    Last Post: 03-21-2008, 05:16 AM
  3. Replies: 12
    Last Post: 02-25-2008, 06:28 PM
  4. Zimbra shutdowns every n hours.
    By Andrewb in forum Administrators
    Replies: 13
    Last Post: 08-14-2007, 08:55 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 10:38 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
  •