Postfix local delivery and relay

Discussion in 'Server Operation' started by apricotweb, Jul 3, 2007.

  1. apricotweb

    apricotweb New Member

    I have been given the task of setting up a backup mx server for my work. I would like to use postfix for this as I am most familiar with it. But if there is another MTA more suited to the task I would be willing to learn it.

    The backup server needs to relay the mail to the main MX but also deliver a copy locally so it can be checked via POP. What would be the best way to achieve this? I think I have worked out how to do this in theory and I have the relay part working. But there are a few areas that I'm not sure about.

    1) Is it possible to remove the email from the mailbox when it has be successfully relayed?

    2) How can I stop postfix bouncing emails when they can't be relayed on.

    3) I was thinking of using recipient_bcc_maps, is there a better way of doing this?
  2. falko

    falko Super Moderator ISPConfig Developer

  3. apricotweb

    apricotweb New Member

    I wrote a long reply and when I clicked "Post Reply" it vanished :(

    Thanks falko, I have read that tutorial and many others, and now have the basic backup MX running. I have managed to get it to also deliver a copy locally by adding:

    recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
    to /etc/postfix/ then /etc/postfix/recipient_bcc would look like this:

    [email protected] localuser
    @foo.tld otherlocaluser
    @bar.tld anotherlocaluser

    This works nicely. The two problems that I have are that if mail cannot be delivered locally for lack of space or what ever it will bounce an error email to the sender and the same for relaying. One of them needs to be told not to bounce emails, not sure which one yet.

    The other is that the emails needs to be deleted from the local user Maildir when it is successfully relayed. I think I have a solution for this one. I have an IMAP interface setup (eventually for web-mail). I thought I could pipe the postfix log to a script that would parse the data and delete the email via IMAP when relayed. Can anyone see any potential problems with this? Has anyone done this before, someone must have!
  4. falko

    falko Super Moderator ISPConfig Developer

    I think that could work, but I haven't done anything like this myself.

Share This Page