How to copy messages between mailboxes?

Jason Voorhees jvoorhees1 at gmail.com
Wed Feb 25 17:45:25 EST 2009


Hi people:

I'm trying to create a script to copy "certain" messages from a
mailbox of user A to mailbox of user B. These are the steps I have in
mind:

1. Select what messages to copy from mailbox of user A. They can
message files located at different folders within its mailbox.

2. Choose where to copy messages in mailbox of user B.

3. Make the copy with cp and assign appropiate perms.

4. Reconstruct the mailbox of user B

These would be the commands:

# mkdir /var/spool/imap/a/user/B/Recent
# cd /var/spool/imap/a/user/A
# cp 234. 235. 236. Drafts/12* /var/spool/imap/a/user/B/Recent
# chown -R cyrus:mail /var/spool/imap/a/user/B/Recent
# su cyrus -c '/usr/lib/cyrus-imapd/reconstruct -r user/B'

I thought this it would be enough, but I know I'm missing some things:

1. What name should I assign to message files being copied from A to
B? I know that their name is equal to its UID. So, what's the value of
the major UID? Does every folder mantain its own UID sequence?
2. There are no cyrus.header, cyrus.index nor cyrus.cache files at
/var/spool/imap/a/user/B/Recent because I just created that directory.
So... I don't need to copy those files from A because reconstruct will
create them... is this right?

I know my English isn't very good yet to explain my question
correctly, but I hope someone can understands me to help me a bit with
this.

Thanks, bye


More information about the Info-cyrus mailing list