Import Maildir (Postfix) to zimbra


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Import Maildir (Postfix) to zimbra
# 1  
Old 01-07-2018
Linux Import Maildir (Postfix) to zimbra

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.

Last edited by Scrutinizer; 01-07-2018 at 11:14 AM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to extract data from Active Directory and import in Zimbra Ldap

Hello Experts, I have this specific requirment where i need to download/extract from AD (Firstname, LastName, etc) and upload the same to Ldap used by Zimbra mail server running on Suse Linux. I know how to manually do that, but that is the not the solution. I am not yet sure on how to start... (3 Replies)
Discussion started by: Siddheshk
3 Replies

2. UNIX and Linux Applications

Postfix: Active Directory and postfix alias

I have a mailserver with postfix i want to alias all mail for administrator@domain.fqdn to root@domain.fqdn I have the aliases configured,and i did newliases but doesn't work. How to did this?Postfix is configured for virtual domain on ad server. (2 Replies)
Discussion started by: Linusolaradm1
2 Replies

3. Shell Programming and Scripting

bash dump raw email body txt from Maildir

I'm setting up a cronjob that will hopefully dump the contents of a email delivered to Maildir/new/ to /home/user/raw.txt (and then delete that email) I could manually remove the bottom line of the raw email, then place the contents in the next line up in the /home/user/raw.txt, but it seems to... (5 Replies)
Discussion started by: unclecameron
5 Replies

4. Red Hat

Maildir quota in postfix.... urgent help

Friends, I am new to the postfix mail servers. My setup was configured with the below Mail Server(MTA,MRA) Postfix, Courier-IMAP Operating System Redhat Enterprise Linux 5.4 . SPAM Protection/Content Filter IMSS 7.1 DNS,LDAP BIND,OPENLDAP WebMail ... (0 Replies)
Discussion started by: kmvinay
0 Replies

5. UNIX for Dummies Questions & Answers

Please help with Postfix config issue - How to allow remote Exchange server to relay to my postfix

Hi guys One of our clients have a problem with sending email to a certain domain. No matter what we try, the mails just dont get delivered. What I did then, is created a new connector on their Exchange server, pointing all mail sent to their client at "domain1" to relay to our Postfix mail... (0 Replies)
Discussion started by: wbdevilliers
0 Replies

6. IP Networking

postfix - reinject mail to postfix from hold queue directory

hi all. Am using smtpd_recipient_restrictions & check_recipient_access in postfix. The hash file looks like this: emailaddress1 HOLD emailaddress2 HOLD The aim is to place email from these recipients in the hold directory,check them then reinject them back in postfix on some... (0 Replies)
Discussion started by: coolatt
0 Replies

7. UNIX for Dummies Questions & Answers

Script to delete mails from maildir

Hi buddies, Anybody has any script to delete mails from Maildir/cur??? I mean is it possible to delete mails from Maildir/cur matching a particular subject like spam or fax??? Thanks in advance (1 Reply)
Discussion started by: squid04
1 Replies

8. UNIX for Dummies Questions & Answers

maildir question

Hi, I had a server hosting my website which kept all of my mail in a folder of my home dir called "mail". In that folder was "cur", "new", "tmp"... Which as I understand is the maildir format. I just recently switched to a new server, and am attempting to transfer all my mail over, however,... (0 Replies)
Discussion started by: patrick99e99
0 Replies

9. UNIX for Dummies Questions & Answers

Maildir or mbox??

Hi, I was wondering if someone can tell me what the difference is exactly between maildir and mbox. We have a few solaris 9 systems here and would like to get an imap server running on them. I have setup fetchmail so that it retrives remote pop3 mail into an account, and that mail is then... (3 Replies)
Discussion started by: sugarat
3 Replies
Login or Register to Ask a Question