How to block mail spammers

You can filter most spammer IP addresses from the logs using this command (it’s not strictly a RFC requirement, but almost all spam relays don’t have a valid PTR)

./launcher logs mail-receiver | grep -v 'unknown' | grep -E 'NOQUEUE'

If you are getting spam from seemingly legit server it is still difficult to block senders using an email domain, as it can be easily spoofed, so your best bet is to find the IP of the sending SMTP server and block it

./launcher logs mail-receiver | grep -E '[0-9A-F]{10,}:.+(from=<[^>]|client=)'

First result in a pair will give you a SMTP server IP, and the second one will give you a sender address.

You can use the instructions described in

to configure the mail-receiver. I’ve eliminated almost all spam using this approach.