I’m adding once a day mail delivery to my site. Messages are marked by the sender as “overnight” or “once a week” delivery.
The way I’m planning on implementing this is to queue messages until midnight in a MySQL database. Each mailbox will be kept in two Dovecot mailstores. The first mailstore will give the users IMAP access to their mailbox. A second mailstore will hold the next day’s new messages. At midnight, a cron job runs to send messages in the MySQL database out to the second mailstore. Then, at 6am, a second cron job will run to sync the two mailstores using doveadm sync.
What I am expecting to happen is that during the day, notification messages (from the site) may be delivered to the first mailstore (the one providing IMAP access to the user) but no messages from other users sent during the day will come until after 6am the next day. Each time the user submits a new message, a notification message is sent back to the sender with a link for editing the queued message in the MySQL database and an indication of when it is scheduled for delivery.
I am kind of assuming that the morning sync process is fast enough so it can easily complete before noon (in 6 hours) even if I end up having lots of mailboxes on each fully loaded Dovecot server.
Is the doveadm sync process reliable and efficient enough for this type of “once a day” morning new message mail delivery?
Or, should I just start delivering messages after midnight and not bother with the second mailstore and subsequent sync?
Just looking for any advice… I kind of like the idea of modeling my mail service after the US Post Office where the mailman delivers new mail once a day rather than like Twitter/Facebook where messages are posted in real time to encourage users to monitor their boxes throughout the day.
Kevin