Email merge -> 2 Accounts -> Same domain

I can't think of an easy way.

Move the contents of each mail subdirectory (remember each one has both cur and new) into the contents of the other one, then remove all files starting with dovecot so next login will create new index.

Don't forget subdirecotires (subfolders) usually are invisible to standard directory listings (they begin with . character.

One way might besomething like this, but remember I do NOT guarantee anything I post on these forums. If you need my guarantee ask for a quote on having me do this for you; write me at the address below in my siglines for more information):
Code:
cd /home/USERNAME/imap/DOMAINNAME
tar -czvf movetopersona.tar.gz personb
mkdir /home/newtempdir
mv movetopersona.tar.gz /home/newtempdir
cd /home/newtempdir
tar -xzvf movetopersona.tar.gz
mv personb persona
rm movetopersona.tar.gz
tar -czvf movetopersona.tar.gz persona
cd /home/USERNAME/imap/DOMAINNAME
tar -xzvf movetopersona.tar.gz
locate . -iname "dovecot*" | xargs rm -f
Note again: DO NOT DO THIS unless you're comfortable that I've made no mistakes and are willing to take full responsibility for any errors. I'm not comfortable, because I haven't tried it. I cold have inadvertently left something out or have a mistake which will delete everything on your server. If you want to hire me to do this for you I'll try it first to be sure it works, and then I'll do it on your system. Write me at the email addrss below in my siglines for details on how to hire me.

Note this will NOT merge any sieve rules from personb into the persona account as I've not studied how to do that or if it is even possible.

Jeff
 
Hello,

Why so complicated? Why don't you simply

Code:
mv /home/<username>/imap/mydomain.com/personb/Maildir/* /home/<username>/imap/mydomain.com/persona/Maildir/
?


Or add/open both IMAP accounts in your Mail Programm (Outlook, Windows Mail, etc), and drag-drop emails from personb to persona
 
Last edited:
zEitEr, your version might actually need to be more like:
Code:
cd /home/username/domains/domain.com/persona/Maildir
cp -Rp .[^.]* ../../personb/Maildir/
else you'd end up with persona/Maildir/Maildir... I think, also have not tested the [globbing] too much, but seems to work, only copies files/folders that start with a dot, and are not . or .. (thus skips dovecot indexes)

I've just written another option (I use this in some of my accounts) which allows for both accounts to still exist, but for an email account to show up as a folder in another account:
http://help.directadmin.com/item.php?id=566

John
 
Hello John,

Thank you. I've corrected the command. Usually I prefer moving emails in my Mail Progamm. Or moving in shell folder by folder, without a recursion, so not to move/copy dovecot's indexes and other system files.
 
Thanks to both of you for making my complex ideas more simple.

Alex, I can't do this in my local client because I use RoundCube, which can only log into one user at a time. But yes, if you use a local imap client with multiple logins, that works well, and can be simple, if time-consuming and user-intensive.

As far as doing it folder by folder... I've done it that way in the past but find it takes a lot of personal time, whereas my idea (and your original one, as 'fixed' by John) requires little user intervention once it's started.

Jeff
 
I also can't do this in my local client because I use roundcube... Maybe it's time I use a local imap client with multiple logins, instead!!
 
I also can't do this in my local client because I use roundcube... Maybe it's time I use a local imap client with multiple logins, instead!!
There are advantages and disadvantages to both, and I stayed with a local client for a long time.

One of the issues I ran into with a local client is that I've got over 6 GB of email (maybe more by now). That's a lot to backup locally and a lot of data to move into backup storage from my home office connection (60 mbps down, but only 6 mbps up). And paging through large folders (not to mention searching email bodies) significantly slowed down my desktop (maximum limit of 4 GB RAM).

An issue with with using Roundcube is that if my local connection fails I can't read local email. It hardly ever happens, and when it does, it only happens for a short time, but I'd still like to be able to read email.

Another issue, which may be important to you is that I no longer have multiple email accounts at nobaloney.net. Only one, which I log into with Roundcube. All other addresses are handled with forwarders, and Dovecot Sieve and Roundcube filters, to separate out the emails again into folders. (Most of my other domains have separate email accounts but others are forwarded to the account at nobaloney.net.)

But if you prefer RoundCube you can stick with it, and only open a local client when you need to move things between folders and users :).

Jeff
 
Back
Top