Postfix - How to prevent external clients from using my server as a relay? [closed]

Solution 1:

Your smtpd_relay_restrictions should prevent that anyone can connect to my server and use it as an open relay for spam.

The value of mynetworks does not determine if others can email you. 127.0.0.0/8 is a correct value 0.0.0.0/0 is not.

What determines if email for your account [email protected] is accepted is determined by the settings that inform postfix that it should accept email for the example.com domainname, such as mydestination

Solution 2:

the setting of smtpd_relay_restrictions you have is correct except that you defined your mynetworks wide open (shown below from your main.cf)

mynetworks = 0.0.0.0/0

Just remove mynetworks; the default value should restrict relay access. For example, mine comes out as shown below with default.

postconf -d |grep mynetworks
mynetworks = 127.0.0.0/8 192.168.1.0/24

You should really test your server to ensure that is not an open relay. There are lot of online tools available ex: http://www.mydnstools.info/smtprelay

Ref: http://www.postfix.org/SMTPD_ACCESS_README.html