0

I'm looking for a way to intercept emails received via a dovecot server. Our intent is to somehow capture the header and body of the email, store it in the database (as useable data) which we can process at a later stage.

We're attempting to setup a backup mail server so that when our's goes down, it will capture all emails received and via a cronjob resend these emails to the recipient.

Where would I start? We're happy to use Postfix or any other existing platform to achieve something similiar.

mauzilla
  • 135
  • 8

1 Answers1

2

Mail-server failover has a simple approved solution.

Add low-priority MX record to your DNS-zone:

IN MX 10 mail.domain.tld
IN MX 20 fo.mail.domain.tld

While everything is Ok, messages are passed to the mail.domain.tld. If it went out, messages are passed to the failover MTA fo.mail.domain.tld. Here MTA is configured to use smarthost (that is mail.domain.tld) and while primary server is offline messages are stored in the queue. When primary server wake up, secondary server push all the delayed messages to it.

Kondybas
  • 6,964
  • 2
  • 20
  • 24
  • If I did one thing right today it was to ask a professional :) Thank you! If I were to still want to get the sender/receiver information for each email coming in, is that possible? – mauzilla Jun 01 '15 at 13:08
  • Yes, any half-decent MTA will log this as mail enters and leaves queue. – MadHatter Jun 01 '15 at 13:12