Mailing List Archive

Backup IMAP flags
Hi Paul,



I'd like to make a separate backup for the IMAP flags somewhile, to when I
want restore them for just one user.

Thing is, for the 2nd time this year, I just hit the wrong option on K9
(mark all read), and bummm! All my marked as unread emails in INBOX were
gone, there it goes my pending matters.

K9 is great, but this option should have a confirm!!!



Which table holds this? The rest I'll look at it, the user idnr's etc.



Thanks,

Jorge,
Re: Backup IMAP flags [ In reply to ]
Am 21.06.2014 19:44, schrieb Jorge Bastos:
> I’d like to make a separate backup for the IMAP flags somewhile, to when I want restore them for just one user.
>
> Thing is, for the 2nd time this year, I just hit the wrong option on K9 (mark all read), and bummm! All my marked
> as unread emails in INBOX were gone, there it goes my pending matters.
>
> K9 is great, but this option should have a confirm!!!
>
> Which table holds this? The rest I’ll look at it, the user idnr’s etc.

MariaDB [dbmail]> show fields from dbmail_messages;
+----------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+----------------+
| message_idnr | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| mailbox_idnr | bigint(20) unsigned | NO | MUL | 0 | |
| physmessage_id | bigint(20) unsigned | NO | MUL | 0 | |
| seen_flag | tinyint(1) | NO | MUL | 0 | |
| answered_flag | tinyint(1) | NO | | 0 | |
| deleted_flag | tinyint(1) | NO | MUL | 0 | |
| flagged_flag | tinyint(1) | NO | | 0 | |
| recent_flag | tinyint(1) | NO | | 0 | |
| draft_flag | tinyint(1) | NO | | 0 | |
| unique_id | varchar(70) | NO | MUL | | |
| status | tinyint(3) unsigned | NO | MUL | 0 | |
+----------------+---------------------+------+-----+---------+----------------+
Re: Backup IMAP flags [ In reply to ]
I got the same problem this year...

there are multiple options, create a trigger and save each change to
another table (would be nice but could make problems).

better, copy the content dbmail_messages table every hour to a backup
table.

something like this:

TRUNCATE dbmail_messages_backup;
INSERT INTO dbmail_messages_backup SELECT * FROM dbmail_messages;

in case you set wrong flags you can do:

UPDATE dbmail_messages m, dbmail_messages_backup b SET m.seen_flag =
b.seen_flag WHERE m.message_idnr = b.message_idnr AND
m.mailbox_idnr='<THEMAILBOXNUMBER YOU LIKE TO RESTORE>';

I didn't tested and may delete all your mails (don't think so), so test it
on a test system.

bye

Harald





Am .06.2014, 19:46 Uhr, schrieb Reindl Harald <h.reindl@thelounge.net>:

>
>
> Am 21.06.2014 19:44, schrieb Jorge Bastos:
>> I’d like to make a separate backup for the IMAP flags somewhile, to
>> when I want restore them for just one user.
>>
>> Thing is, for the 2nd time this year, I just hit the wrong option on K9
>> (mark all read), and bummm! All my marked
>> as unread emails in INBOX were gone, there it goes my pending matters..
>>
>> K9 is great, but this option should have a confirm!!!
>>
>> Which table holds this? The rest I’ll look at it, the user idnr’s etc.
>
> MariaDB [dbmail]> show fields from dbmail_messages;
> +----------------+---------------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default |
> Extra |
> +----------------+---------------------+------+-----+---------+----------------+
> | message_idnr | bigint(20) unsigned | NO | PRI | NULL |
> auto_increment |
> | mailbox_idnr | bigint(20) unsigned | NO | MUL | 0
> | |
> | physmessage_id | bigint(20) unsigned | NO | MUL | 0
> | |
> | seen_flag | tinyint(1) | NO | MUL | 0
> | |
> | answered_flag | tinyint(1) | NO | | 0
> | |
> | deleted_flag | tinyint(1) | NO | MUL | 0
> | |
> | flagged_flag | tinyint(1) | NO | | 0
> | |
> | recent_flag | tinyint(1) | NO | | 0
> | |
> | draft_flag | tinyint(1) | NO | | 0
> | |
> | unique_id | varchar(70) | NO | MUL |
> | |
> | status | tinyint(3) unsigned | NO | MUL | 0
> | |
> +----------------+---------------------+------+-----+---------+----------------+
>


--
Harald Leithner

ITronic
Wiedner Hauptstraße 120/5.1, 1050 Wien, Austria
Tel: +43-1-545 0 604
Fax: +43-1-786 23 88 26
Mobil: +43-699-123 78 4 78
Mail: leithner@itronic.at | itronic.at
_______________________________________________
DBmail mailing list
DBmail@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail