Naz Gassiep wrote:
> Thanks very much for taking the time to respond.
> 
> I assume that the physmessages table would contain the message headers,
> and in that sense it could be deduced who the message was from and who
> it was sent to. Is that correct?

No. Headervalues are in the header cache tables (dbmail_headervalue)
which are keyed to the physmessages table. The physmessages table is
just a link-table sitting in between the table containing the blobs
(dbmail_messageblks in 2.2 or dbmail_mimeparts in 2.3+) on the one hand,
and the dbmail_messages table on the other hand. If you delete a
mailbox, the messages table is cleaned out for that mailbox by the
foreign key restraints.

> 
> On a side note, is there a reason that mailboxes are physically deleted
> from the DB? Surely taking a similar approach to mailboxes as is taken
> for messages would be better? I.e., when a mailbox is deleted, it is
> marked as deleted along with all messages in it, and it is only
> destroyed when a purge is done. Is there a reason that approach was not
> taken? 

Legacy. Dbmail was originally developed as a pop3 server where users
have only 1 mailbox. What you propose is perfectly valid and already on
the TODO list.

> Is there an easy way for me to implement this? We really do need
> a comprehensive perpetual record of messages.

The simplest way would be:
- drop the foreign key restraints between dbmail_messages and
dbmail_mailboxes.
- setup a trigger that will update the status field of messages when a
mailbox is deleted.

doing it like that won't even require code changes, just schema changes.

But another approach (more flexible) would be to re-assign a deleted
mailbox to an internal system user like '__archive__' so you can allow
administrators access to deleted mailboxes in a dedicated namespace like
'#Archive'. If a user would delete a mailbox, or if you delete a
complete account, the 'deleted' mailboxes would become visible under:

'#Archive/someusername/some/deleted/mailbox/name'





-- 
  ________________________________________________________________
  Paul Stevens                                      paul at nfg.nl
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands________________________________http://www.nfg.nl
_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to