On Jun 22, 2009, at 6:49 AM, Alessandro Ranellucci wrote:
I was wondering if there's a way to keep the name of the folder
containing each message while retrieving via POP3. I guess this
could be done by dynamically adding a header to messages at
retrieval time. Is there a feature for this or a plugin API?
It's possible to implement as a plugin, but it probably won't be all
that easy.
Otherwise I was thinking about modifying the messages themselves on
the server using a script. However, such a script would need to be
run when a IMAP user moves a message to a folder and I believe
Dovecot doesn't provide a trigger/hook mechanism.
There are copy/save virtual functions that you can override. For
example something similar to what antispam plugin does.
I also don't know if modifying stored messages is allowed since it
could break some caching/hashing mechanism.
Right. You can't modify existing messages. But at the time when a
message is copied to another mailbox, you can save a slightly
different version of it. This of course also means that you can't do
the copying by hard linking a file (assuming you're using maildir).
Hmm. Out of these two possibilities, I think it's easier to just
return a modified message from mail_get_stream(). You could probably
do something similar to what mbox does and use
i_stream_create_header_filter() where you simply return a new X-
Mailbox: header after the headers are sent.