On 14/07/17 06:33, Reindl Harald wrote:
>
>
> Am 14.07.2017 um 13:17 schrieb Thomas Raschbacher:
>> I am considering moving a large amount of older emails to a seperate
>> account (for Archiving reasons).
>> Is there an easy way (maybe in the DB directly) to do this instead of
>> using an imap client (or maybe writing something simple in python )
>>
>> Also I'd want to maybe merge some folders (probably ignoring duplicates
>> for the moment
Dbmail already deduplicates messages.
>>
>> -- the reason I want to do this is because that account is hardly
>> useable anymore with (especially) webmail clients, because it has > 3500
>> IMAP folders
>
> look at the table-structure and the attachment, these are two methods
> of our dbmail-cms-plugin, so yes it is possible, not sure how helpful
> the moethods isolated are without the other classes since i desinged
> the whole stuff in 2009 and never really had to touch the backend code
> since then
Example 1: Move mailboxes from user 1001 to user 1234
BEGIN;
update dbmail_mailboxes set owner_idnr = 1234 where owner_idnr = 1001;
COMMIT;

Example 2: Move messages from user 1001 mailbox Archive to user 1234
mailbox Archive/OldUser
BEGIN;
update dbmail_messages set mailbox_idnr = (select mailbox_idnr from
dbmail_mailboxes where owner_idnr = 1234 and name = 'Archive/OldUser')
where mailbox = (select mailbox_idnr from dbmail_mailboxes where
owner_idnr = 1001 and name = 'Archive');
COMMIT;
>
>
>
>
> _______________________________________________
> DBmail mailing list
> DBmail@dbmail.org
> http://lists.nfg.nl/mailman/listinfo/dbmail


-- 
Sandino Araico Sánchez 
http://sandino.net

_______________________________________________
DBmail mailing list
DBmail@dbmail.org
http://lists.nfg.nl/mailman/listinfo/dbmail

Reply via email to