Ok, stomach. Let's just concentrate on postfix, so we don't have the added complexity of amavisd-new. To that end, make sure that in main.cf you have
Let's also turn on header and body checks, so again in main.cf we should have
Code:
header_checks = regexp:/etc/postfix/header_checks
body_checks = regexp:/etc/postfix/body_checks
Obviously, you should also have the corresponding header_checks and body_files files.
The problem at hand is to prevent header and body checks for outgoing mail, which is the reason you started this thread. For that, we need two smtpd daemons running, one listening for connections from the internet and the other listening for connections from your LAN. The reason you need two daemons is that an smtpd daemon cannot apply header and body checks selectively. It's an all or nothing thing. (When you run amavisd-new, you'll need three smtpd daemons, two before amavis, and one after (the after-filter daemon is the one you mentioned above, listening on the loopback interface).
Ok, so let's decide to have two smtpd daemons, one listening on the its usual port (25) and the other listening on port 587. You can also have the daemons listening on two different interfaces, as per the postfix documentation above, but I think this is simpler. So, master.cf should look like this:
Code:
smtp inet n - n - - smtpd
587 inet n - n - - smtpd
-o receive_override_options=no_header_body_checks
Observe that the daemon listening on port 587 does not perform header and body checks. Even though we configured header and body checks in main.cf, we overrode that configuration in master.cf.
Now, configure all you mail clients (the ones on your LAN) to send mail through your server's port 587, and no header and body checks will be performed on their email.
Once this is working and you understand why it's working, go back and read the postfix documentation (follow the link above). You'll need to fine-tune what we did, for example to prevent header and body checks for mail submitted locally on the server (i.e. submitted using the sendmail command).
Good luck.