I have a local postfix server, and i want it to only relay emails to the only local domain (localdomain.be):
myhostname = localdomain.be
mydomain = localdomain.be
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $myhostname
mydestination = $myhostname
relay_domains = $mydomain
default_transport = smtp
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.0.0.0/24
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: gmail.com).
relay_domains is supposed to ensure that but it does not seem to really filter since i can still send to my gmail address.
Set up /etc/postfix/transport like so:
postmap /etc/transport
and in main.cf put
transport_maps = /etc/postfix/transport
and then postfix reload