Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a staging server running Postfix, which I want to only set up to deliver mail to 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 =
smtpd_recipient_restrictions = reject_unauth_destination

This means the server only relays for 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?

share|improve this question
Is the domain on the same machine or does it have to be relayed to some other machine ? – proy Jan 19 '10 at 21:53
It has to be relayed to an external smarthost. No local accounts exist on this machine. – crb Jan 20 '10 at 10:05

1 Answer 1

up vote 2 down vote accepted

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

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

    transport_maps = hash:/etc/postfix/transport

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

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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