1

Topic: Import mails from old Maildir to new server

I used this: http://www.howtoforge.com/virtual-users … buntu-7.10

Now i have new dedicated server and I want move mails from old server. How can i do it?

2

Re: Import mails from old Maildir to new server

I can't find postfix setting "home_mailbox" in the tutorial, so i assume mailbox is Maildir format. If so, you can simply copy mailboxes to iRedMail server. (Be sure they're copied to correct directory.)

3

Re: Import mails from old Maildir to new server

Use "imapsync" utility, in my experience it does the job flawlessly.

4

Re: Import mails from old Maildir to new server

ZhangHuangbin when i copied then roundcube have only one e-mail, which cant open by me. But numbers of emails was correctly (8100 mails in mailbox, but only 1 in figuring on list).

5

Re: Import mails from old Maildir to new server

Its looking like on screenshot : http://img135.imageshack.us/i/przechwytywaniek.jpg/

rex_ray not working for me:

Temp directory is /tmp
Turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1.
TimeZone:[CEST]
Will try to use CRAM-MD5 authentication on host1
Will try to use CRAM-MD5 authentication on host2
Host1 imap server [poczta.alfaholicy.org] port [143] user [ala@alfaholicy.org]
Host2 imap server [grela.org] port [143] user [x@grela.org]
Banner: * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc.  See COPYING for distribution information.
Host poczta.alfaholicy.org says it has NO CAPABILITY for AUTHENTICATE CRAM-MD5
Error login: [poczta.alfaholicy.org] with user [ala@alfaholicy.org] auth [CRAM-MD5]: 2 NO Login failed.
Error login: [poczta.alfaholicy.org] with user [ala@alfaholicy.org] auth [CRAM-MD5]: 2 NO Login failed.

6

Re: Import mails from old Maildir to new server

"imapsync" takes care of everything from message timestamps, imap folders to attachments. It is absolutely easy if you just figure it out. Please provide the following information for me to help.

1.  What imap server (Dovecot,Courier etc) are you using on both ends i.e  at the old server you wish to migrate and the new server. In my case Dovecot at both ends.

2. What kind of authentication mechanisms are in use on both servers. In my case plain,login at both ends.
 
  If you don't know do the following on both servers,

root@mail:~# telnet mail.example.com 25
Trying 127.0.0.1...
Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP iRedMail (Ubuntu)
ehlo mail.example.com       --> Instead of mail.example.com  type your fully qualified hostname
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN  --> what this  line look like in your output
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

7

Re: Import mails from old Maildir to new server

1. On old server I have courier, on new I have dovecot

2. I dont know.
220 ks358076.kimsufi.com ESMTP Postfix (Ubuntu)
ehlo poczta.alfaholicy.org
502 5.5.2 Error: command not recognized
helo poczta.alfaholicy.org
250 ks358076.kimsufi.com
auth
501 5.5.4 Syntax: AUTH mechanism
AUTH PLAIN LOGIN
535 5.7.8 Error: authentication failed: another step is needed in authentication
^[[A^[[B
502 5.5.2 Error: command not recognized
AUTH SASL
535 5.7.8 Error: authentication failed: no mechanism available

You can check here what auth I have: http://www.howtoforge.com/virtual-users … buntu-7.10 - I install with this tutorial.

8

Re: Import mails from old Maildir to new server

My guess is you already have plain,login authentication support at both ends.

1.  You will need the root user password of both the systems for the following command to work.

2. Plain, login authentication support at both ends. (In most cases plain is enough I think)

3.  There is no need for the username to be same at the two ends. i.e you can migrate jack's mails to jenny's mailbox


Do a dry run first for checking: (in a single line)

imapsync --syncinternaldates --subscribe --host1 192.168.1.100 --host2 192.168.1.20 --user1 jack --authuser1 root --password1 google --user2 jenny --authuser2 root --password2 yahoo --noauthmd5 --dry

If it runs correctly then let her rip,

imapsync --syncinternaldates --subscribe --host1 192.168.1.100 --host2 192.168.1.20 --user1 jack --authuser1 root --password1 google --user2 jenny --authuser2 root --password2 yahoo --noauthmd5

  host1 192.168.1.100 --> mailserver that has jack's mailbox

  host2 192.168.1.20 --> mailserver that has jenny's mailbox (i.e destination)

  authuser1 --> host1's root user & --paswd1 host1's root user password

  authuser2 --> host2's root user  &  --paswd2 host2's root user password

  noauthmd5 --> Don't use md5 based authentication mechanisms i.e cram-md5 or digest-md5. So only, we need plain or login mechanisms, after migration you can revert back to using cram-md5, digest-md5 or other auth mechanisms,

  syncinternaldates --> make sure the timestamps are preserved

  subscribe --> subscribe the imap folders in the original mailbox

9

Re: Import mails from old Maildir to new server

Its working, thanks!

Do You know solution to move mails from 50 Maildirs to new server? big_smile Im must moving single accounts or not? smile

10 (edited by robertut 2010-10-24 22:46:17)

Re: Import mails from old Maildir to new server

Alright, here's how it goes when you need to import e-mails from a Gmail account:

imapsync --syncinternaldates --host1 imap.gmail.com --host2 192.168.1.11 --user1 your_user@gmail.com --password1 your_pass --user2 your_iRedMail_account_user --password2 your_iRedMail_account_pass --authmech1 LOGIN --port1 993 --ssl1 --useheader="X-Gmail-Received" --useheader 'Message-Id' --noauthmd5 --allowsizemismatch --exclude 'Trash|Spam'

Just make sure the --exclude parameter contains Gmail labels you want to exclude in your own language you use Gmail. I suggest to try with  --dry first, to see what would happen before.

You may also get duplicates too, because in Gmail messages can be in multiple folders at once (same message with multiple labels). So you either use --exclude, or remove multiple labels (archive messages which are labelled with others than "incoming".