Below is my use case

I want to send email via postfix relay that refers another postfix relay server which is using an external SMTP server:

[client] --->[Postfix1]---->[Postfix2]----->[External SMTP]

So I will be creating docker image for Postfix1 with keeping all the information of Postfix2 in main.cf file, & Postfix2 will have all the necessary details of External SMTP server.

So if user wants to send email they configure Postfix1 in their configuration which then communicates with Postfix2 and Postfix2 passes that request thru external SMTP server.

Is this possible??

I have done the same setup but I am getting "Relay access denied (in reply to RCPT TO command)" I have added all the authentication files and information by referring some of the other post but it didn't help, for example: https://serverfault.com/questions/693255/relay-access-denied-in-reply-to-rcpt-to-command-postfix-issue

Can you please guide me on what I am doing wrong?

1 Answer 1


You need to

  • Tell Postfix1 to forward all traffic to the relayhost Postfix2
  • Configure Postfix2 to accept traffic from Postfix1

This is done with the configuration snippets (Make sure you have only one of the directives in each main.cf):

  • Postfix1:
# forward all traffic to Posfix2
relayhost = Postfix2
# make sure you receive bounces
bounce_notice_recipient = [email protected]
  • Postfix2:
# add remote Postfix to local networks
mynetworks = <Ip-of-Postfix1> [other IPs]
# relaying accepts mail from local networks
smtpd_relay_restrictions = permit_mynetworks reject_unauth_destination

You should take care of the authentication at Postfix1, without a proper setup it would be possible to send massive amounts of SPAM through Postfix1.

  • Hello Gerhard, I will try your suggestion and confirm, thank you for your time and support
    – Samurai
    Aug 10, 2022 at 6:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .