3

I have a staging server running Postfix, which I want to only set up to deliver mail to example.org. If we are testing a function that sends e-mail, we want to be able to know that we won't accidentally send any test messages out to anyone outside our test domain.

All mail is sent from this server to a smarthost for delivery.

I have set up

relay_domains = example.org
smtpd_recipient_restrictions = reject_unauth_destination

This means the server only relays for example.org by SMTP. However, using mail(1) on the server, it will deliver for all addresses. How can I restrict this to the relay_domains only?

2
  • Is the domain example.org on the same machine or does it have to be relayed to some other machine ?
    – proy
    Jan 19, 2010 at 21:53
  • It has to be relayed to an external smarthost. No local accounts exist on this machine.
    – crb
    Jan 20, 2010 at 10:05

1 Answer 1

3

None other than esteemed Postfix author Wietse Venema gives us the answer:

Perhaps with a transport table, taking advantage of its special syntax:

/etc/postfix/main.cf
    transport_maps = hash:/etc/postfix/transport

/etc/postfix/transport:
    example.org :
    *      error:we do not deliver this domain

The above will reject SMTP mail, and bounce local submission, for domains other than example.org.

You must log in to answer this question.

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