Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from superuser.com 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
add comment

1 Answer 1

up vote 0 down vote accepted

Set up /etc/postfix/transport like so:

mydomain.com :
*               error:mail for * is not deliverable

postmap /etc/transport

and in main.cf put

transport_maps = /etc/postfix/transport

and then postfix reload

share|improve this answer
add comment

Your Answer

 
discard

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.