[Dovecot] From Maildir back to smtp

Charles Marcus CMarcus at Media-Brokers.com
Fri Feb 24 14:18:43 EET 2012

On 23/02/2012 21:41, Marc Perkel wrote:
> Not sure how this can be done.
> Right now I'm running a free backup MX record service. People point
> their high MX records to my servers and if they go down we store the
> email. When they come back up it's delivered.
> What I want to do is have a premium service that would allow them to
> view through IMAP the stored email. In order to do that I would have
> to deliver the email locally to a dovecot server - to a single account
> perhaps - and they can view/forward/delete etc.
> But - when their server comes back online I'd like to gather up all
> the delivered email stored in Maildir format and run it back into smtp
> for delivery.

I'm thinking it would be possible to use dsync for this? Ideally you 
would have to have a way to maintain a duplicate of the AUTH database, 
so that users could use their current passwords for accessing it (this 
would obviously require the approval and cooperation of whoever you are 
providing this service to), but this way you could store each users mail 
individually and provide relatively painless access (since all each user 
would need to know is the backup host name and their username/password).

You'd have to configure a script on your end to:

1. determine a reliable way to differentiate between a temp-fail 
situation on the primary (in which case you just act as a normal backup 
MX), or an extended outage (15 minutes? 1 hour? I'd probably let the 
customer decide this one), which would determine when you start actually 
taking delivery of their mail to the 'standby' server

2. monitor for when the primary comes back online

3. wait xx interval to make sure the primary stays up (again, I'd let 
the customer decide this, but with a sane minimum that you define)

4. once the primary stays up for the required interval, dsync a one way 
'dump' of the stored mails, being sure to test for success - and this 
process would obviously have to take into account the possibility of the 
primary going down again in the middle of the dsync

5. mv successfully restored mails on the backup mx to a temp location 
for xx 'safety' interval 'just in case'

6. delete the backed-up/stored mail that has been successfully dsync'd 
after the safety interval has elapsed


Best regards,


More information about the dovecot mailing list