One more question:
Does “doveadm sync” replicate messages with refcount=0 at the time of sync’ing?
The reason I ask is that, in my case of sync’ing with a “next-day” mail server overnight, all messages that might have been saved by IMAP but deleted shortly thereafter, should still be in the user’s mailbox with refcount=0. Correct?
If “doveadm sync” does replicate all messages, whether expunged or not to the “next-day” server, I can run “doveadm search -A” to find all messages saved by IMAP and archive them. This would not put any extra load on my mail servers and allow me to run this extra processing at night on a dedicated “next-day” mail server.
Kevin
On Jun 18, 2016, at 11:20 AM, KT Walrus kevin@my.walr.us wrote:
How do I configure Dovecot IMAP for this use case?
I just thought of one possible way to do this:
- 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)
- 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
- 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@my.walr.us wrote:
On Jun 17, 2016, at 8:01 PM, chaouche yacine yacinechaouche@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@my.walr.us To: Dovecot Mailing List dovecot@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