Import Maildir (Postfix) to zimbra

Looking to migrate to ZCS? Ask here. Got a great tip or script that helped you migrate? Post it here.
arsyam
Posts: 3
Joined: Fri Jan 05, 2018 7:03 am

Import Maildir (Postfix) to zimbra

Postby arsyam » Mon Jan 08, 2018 2:01 am

Dear,

I want to migrate mailbox from ISP Config (postfix) to zimbra. and have tried import maildir to zimbra with script :



Code:
#!/bin/bash

#

# Maildir to Zimbra import

# Drop in your user root and run as superuser.

#

ZMM="/opt/zimbra/bin/zmmailbox"
domain="psmti.org" # change to your domain!

#for user in `ls -d1 */|sed s/\///`
#for user in `ls -d1 */|sed s/\\\///`
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 "LINE2 $line2"

#echo "FOLDER $folder"

if [ "$folder" = "cur" ]

then

$ZMM -z -m $user@$domain addMessage Inbox $PWD/$user/Maildir/cur

$ZMM -z -m $user@$domain addMessage Inbox $PWD/$user/Maildir/new

else

if [ "$folder" != "Sent" ] && [ "$folder" != "Drafts" ] && [ "$folder" != "Junk" ] && [ "$folder" != "Trash" ]

then
echo $folder | tr '.' '
' > /tmp/qq
folder=""

while read x;

do

folder="$folder/$x"
if [ $($ZMM -z -m $user@$domain gaf | grep "$folder" | wc -l) == 0 ]; then

$ZMM -z -m $user@$domain createFolder "$folder"

fi

done
else

folder="/$folder"

fi
$ZMM -z -m $user@$domain addMessage "$folder" "${PWD}/${line}"

$ZMM -z -m $user@$domain addMessage "$folder" "${PWD}/${line2}"

fi
done
done




But there are still errors, and not all emails can be imported.



Code:
User ali.johan

ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk/cur/ali.johan/Maildir/.Sent Items)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk/cur/ali.johan/Maildir/.Sent Items/cur/ali.johan/Maildir/.Sent)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk/cur/ali.johan/Maildir/.Sent Items/cur/ali.johan/Maildir/.Sent/cur/ali.johan/Maildir/.Spambox)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk/cur/ali.johan/Maildir/.Sent Items/cur/ali.johan/Maildir/.Sent/cur/ali.johan/Maildir/.Spambox/cur/ali.johan/Maildir/.Trash)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk/cur/ali.johan/Maildir/.Sent Items/cur/ali.johan/Maildir/.Sent/cur/ali.johan/Maildir/.Spambox/cur/ali.johan/Maildir/.Trash/cur/ali.johan/Maildir)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk/cur/ali.johan/Maildir/.Sent Items/cur/ali.johan/Maildir/.Sent/cur/ali.johan/Maildir/.Spambox/cur/ali.johan/Maildir/.Trash/cur/ali.johan/Maildir/cur)
ERROR: zclient.CLIENT_ERROR (unknown folder: /ali.johan/Maildir/.Drafts/cur/ali.johan/Maildir/.Junk E-mail/cur/ali.johan/Maildir/.Junk/cur/ali.johan/Maildir/.Sent Items/cur/ali.johan/Maildir/.Sent/cur/ali.johan/Maildir/.Spambox/cur/ali.johan/Maildir/.Trash/cur/ali.johan/Maildir/cur)

User andrew

ERROR: service.INVALID_REQUEST (invalid request: missing required attribute: l)
ERROR: service.INVALID_REQUEST (invalid request: missing required attribute: l)

User angelines

ERROR: service.INVALID_REQUEST (invalid request: missing required attribute: l)
ERROR: service.INVALID_REQUEST (invalid request: missing required attribute: l)

User angkah

ERROR: service.INVALID_REQUEST (invalid request: missing required attribute: l)
ERROR: service.INVALID_REQUEST (invalid request: missing required attribute: l)

Please help me.

Thanks before.


Return to “Migration”

Who is online

Users browsing this forum: No registered users and 5 guests