How to copy messages between mailboxes?

Jason Voorhees jvoorhees1 at gmail.com
Thu Feb 26 09:42:04 EST 2009


On Wed, Feb 25, 2009 at 6:16 PM, Bron Gondwana <brong at fastmail.fm> wrote:
> On Wed, Feb 25, 2009 at 05:45:25PM -0500, Jason Voorhees wrote:
>> 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:
>
> Wrong steps.  That's not a good way to do it.
>
Well, I just based on the example shown in the cyrus documentation. It
says that a message file recently copied it will no be visible until
reconstruct command is executed.


>> # 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'
>
> Use IMAP.
>
> a) Connect as an admin (with permissions on both user.A and user.B)
>
> b) CREATE user.B.Recent
>
> c) SELECT user.A
> d) UID COPY 234,235,236 user.B.Recent
>
> e) SELECT user.A.Drafts
> f) UID COPY 12:* user.B.Recent
>
> ------------
>
> Much cleaner, and you get all the locking goodness of doing it the
> RIGHT way.
>
> An alternative to being admin is just adding read ACLs for user
> B on user A's folders (as user A), then logging in as user B and
> doing these steps.
>
> You can use any IMAP client library.  We use Perl Mail::ImapTalk,
> but whatever language you're familiar with is fine.
>
> Bron.
>
Unfortunately, I know almost nothing about programming :( It doesn't
seem a good idea to learn programming now just to solve this little
issue.
Anyway I know that programming is necessary to me so I'll learn as
soon as I have enough free time.

Thanks anyway people, I'll read about Perl::ImapTalk

Bye


More information about the Info-cyrus mailing list