So, I am setting up a backup mail server.

I got it relaying messages (saving them to queue and then, as soon as primary's up, deliver them to primary). It took following two lines:

relay_domains = $mydestination domain.tld
smtpd_recipient_restrictions = permit_mynetworks

However. I want a secondary not only to relay messages, but also to store them to local mailboxes (provided, the local mailboxes with needed names exist), so I could access them in case of emergency via, say, roundcube webmail.

How do I make Postfix both relay and receive messages at the same time?

  • An MX20 relay is not best practice for postfix redundancy, its better to go with 2 equivalent MX10. If you are able to read german, I can suggest you to read this article from Heinlein: heinlein-support.de/upload/mk4/… – Henrik Jan 18 '15 at 10:36
  • Hell yes am I able to read German. Thanks for the article. – dr.Equivalent Jan 19 '15 at 16:56

One solution can be to have the relay server has a fake domain and then using recipient_bcc_maps BCC all the messages to local addresses with the fake domain.

Add to main.cf the following:

recipient_bcc_maps = hash:/etc/postfix/recipient_bcc_maps

and also add fake.domain.com to the end of mydestination = ..., this way this server will get the all of the user@fake.domain.com e-mails (if the user exists).

In /etc/postfix/recipient_bcc_maps put:

user@your.domain.com user@fake.domain.com

than run postmap recipient_bcc_maps

This way to every message to user@your.domain.com a BCC will be added to user@fake.domain.com so the message will be stored locally.

  • I think, it might be something that would work. Could you please explain in more detail? – dr.Equivalent Jan 19 '15 at 0:30
  • You're welcome! – Stone Jan 20 '15 at 8:28
  • Can I apply some sort of wildcard, so that I'd not have to edit files every time users are added? – dr.Equivalent Jan 20 '15 at 13:42
  • Maybe by using prce based recipient_bcc_maps. Put recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc_maps in main.cf, and /^(.*@your\.domain\.com)/ ${1}@fake.domain.com in it. But haven't tried it myself. – Stone Jan 20 '15 at 13:51
  • Looks like we're out of luck on this one, sadly. Or it needs to be addressed further. Anyway, thanks for the help, I really appreciate it. – dr.Equivalent Jan 20 '15 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.