Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Postfix for duplicating mail to two relayhost


    I want to duplicate every mail received by postfix (configured as SMTP relay) to two differents servers. I know that is strange but i have to do this.
    Example: every mail received for every user of my domain must be routed by postfix to my old mail server AND to my new server (
    Mail adresse must be the same for both server.

    I have considered bcc command but I think that this command impose me to change mail addresse I have to change the domain name.
    If anyone have an idear to do this it would be very nice.



  2. #2
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    North Carolina
    not sure why you would want to do this. are you migrating from one server to the other? Not sure why you would want the same accounts to exist in both places.

  3. #3
    Yes it's to migrating slowly my old server to my new.
    Is there a way to do what I want with postfix.


  4. $spacer_open
  5. #4
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    North Carolina
    the only reason I ask is because I did this not very long ago. migrated mdaemon to exchange. the accounts did not all exist on both servers at the same time though. All accounts did exist on postfix and as we migrated account(s) over we would update postfix using webmin (because not all my admins are ssh savy).

    if you are looking for something like that I can offer some help. but if you are wanting to duplicate the mail to both servers, I don't know what would be best.

  6. #5
    Yes i want that my postfix (configured as SMTP relay) duplicate mail to both server.
    It's sounds like doing a bcc for every incoming mail to second mail server. First mail server will received mail normaly as actually.

    I have search an a lot of forum but din't found any good solution.
    I have a idear to do this but I have do bring up a second postfix so this will be so complicated.
    My question is can I configure posfix ( as relay SMTP) to transport mail for my domain to two mail server (duplicate mail). mail address and domain mail is the same on both server.

    Thanks for your reply

  7. #6
    No gaatby, you can't. You can have it round-robin, though, but not simultaneous for the same addresses.
    What's the old server, and what's the new server? Same software (maybe different version), or completely new type of MDA e.g. old is Cyrus, new is Exchange?
    I wouldn't like BCC (from a user and admin perspective):
    1) on the new server, I would have a different email address than in the old server;
    2) You'd have to migrate twice: one from old to new, and two from new to old email address in the new server.
    You end with two, because Postfix will route the same email address the same way time and again.

    What you *should* look at is the content_filter. The content filter is a simple server program that listens to a specific port and gets mail from postfix. It then filters whatever needs filtering, and optionally sends stuff back to the postfix with various options included. In the filter program, I would then simply forward the mail to the new server, and feed the mail back into to local postfix for delivery. This way, you can have a sort of postfix tee Have a look at amavisd for how to implement this. Also Perl programming comes in handy in this case.

    In general your content_filter would be something like
    smtp-tee unix - - y - 2 smtp -o smtp_data_done_timeout=1200 inet n - n - - smtpd
    -o content_filter=
    -o my_networks=
    -o smtpd_recipient_restrictions=permit_mynetworks,rej ect

    This way, the server you implement listens on port 10024, gets the mail, and simply forwards it to port 25 on your new mail server. After that, it forwards it to port 10025 on the local server for further processing, that is: delivery.

    Also, if you already have an antispam/antivirus configured, you can chain these elements (spamfilter and tee) by setting the content_filter parameter of one postfix input port to the other content_filter. So you can have antispam/antivirus checking done before you filter the mail to your tee.

    Hope this is clear

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts