Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a local postfix server, and i want it to only relay emails to the only local domain (

myhostname =
mydomain =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $myhostname
mydestination = $myhostname

relay_domains = $mydomain
default_transport = smtp
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 64000000
message_size_limit = 1000000
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtp_host_lookup = native

This configuration works fine to allow relay mail locally and on external destination domains, but i would like it to be an impossibility to send to other domains (ie:

relay_domains is supposed to ensure that but it does not seem to really filter since i can still send to my gmail address.

share|improve this question

migrated from Feb 9 '11 at 14:34

This question came from our site for computer enthusiasts and power users.

Are you testing ("i can still send to my gmail address") from outside or from inside? Clients within $mynetworks are exempt from some restrictions. – grawity Feb 9 '11 at 14:56
up vote 0 down vote accepted

Set up /etc/postfix/transport like so: :
*               error:mail for * is not deliverable

postmap /etc/transport

and in put

transport_maps = /etc/postfix/transport

and then postfix reload

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.