archive all saved IMAP messages
KT Walrus
kevin at my.walr.us
Sat Jun 18 15:20:49 UTC 2016
> How do I configure Dovecot IMAP for this use case?
I just thought of one possible way to do this:
1. Backup all mail servers every hour or so using “doveadm sync -1” to a mail server that uses Maildir (my source mail servers are using mdbox)
2. Run a script on the backup server that uses the “find” command to identify all new messages in the Maildir folders that have appeared since the last backup
3. Send these new messages to my archive server if the headers in the messages indicate that they were stored by the user directly and not “Received” from outside the mail server
This will pick up messages that have been saved by APPEND and not deleted before the backup command runs.
As I type this, maybe I should just do this hourly check on the source mail servers using the “doveadm search -A” command combined with the “doveadm fetch” command to extract the newly saved messages and check their headers to determine whether the message was saved by IMAP. Newly saved IMAP messages could then be sent to the archive mail server (or queued in Redis for further processing).
> On Jun 18, 2016, at 10:46 AM, KT Walrus <kevin at my.walr.us> wrote:
>
>
>> On Jun 17, 2016, at 8:01 PM, chaouche yacine <yacinechaouche at yahoo.com> wrote:
>>
>> I'm also interested in learning how to do this best. Last time I thought about it is if users have a different e-mail address on the archive server, you can setup a BCC map in postfix that matches the pair of emails (primary email - archive email), this will automatically send all sent messages in the inbox of the archived email account. In that archive server you can setup sieve rules to move the emails to the sent folder. But that's rather a complicated solution, besides it doesn't work draft folder.
>
> Yes. I already have Postfix set up to send a copy of all incoming messages to an archival Dovecot mail server. This was rather easy to do since I have Postfix deliver all inbound messages to a shell script that queues the message in a Redis queue and then sends the message to the archive.
>
> But, my issue is capturing all IMAP saved messages (via IMAP APPEND command). Is there any way to “hook” into the APPEND action to send a copy of the message to the archival Dovecot mail server? I’d really like to just post-process the APPENDED messages with a shell script that is similar to my Postfix shell script (that queues to Redis and sends to the archive).
>
> How do I configure Dovecot IMAP for this use case?
>
> Kevin
>
>>
>>
>>
>>
>>
>>
>>
>> ________________________________
>> From: KT Walrus <kevin at my.walr.us>
>> To: Dovecot Mailing List <dovecot at dovecot.org>
>> Sent: Friday, June 17, 2016 9:18 PM
>> Subject: archive all saved IMAP messages
>>
>>
>> I need to archive (i.e., send to another mail server) all messages saved on my mail servers. I’ve implemented for SMTP submission, but haven’t figured out how to archive messages saved by IMAP (like to Drafts, Sent, etc.).
>>
>> How would I best implement this? Can I enable Sieve plugin for IMAP? Or, some other method? Like one way backup to archive server?
>>
>> I really only need to archive the messages sent/saved by a user and not the messages received from other users.
>>
>> Kevin
>
More information about the dovecot
mailing list