postfix: relay access denied. How to fix it?

Solution 1:

Notice this part in main.cf:

smtpd_recipient_restrictions = permit_mynetworks ...

So smtpd only permits IP addresses from mynetworks to relay emails.

What you need to do is to add your IP to mynetworks. For example, if your IP address is 192.168.1.123, change the parameter to

mynetworks = 127.0.0.0/8 192.168.1.123

Then you can send emails successfully.