Postfix - How to enable to check if recipient exists/registered before sending emails to stop spam by malware

Hi,

I am looking for a way so that the postfix should check if email recipient is exists/registered with any domain hosted on the server before sending emails.
Recently some of the websites were hacked and hackers could be able to send thousands of emails per hour which could blacklist the server IP address.
They used random email ids to send emails which aren’t really registered on the server.

It would be great if the server can somehow force postfix to check if “From:” recipient is registered before sending the email.

Set mail rate limiting to allow e.g. 1 email per second. Set up a monitor on the mail queue so if it goes over a certain amount which you you can set you get an alert and so can investigate.

/* REMOVE ALL MAIL FROM MAIL QUEUE FROM A SPECIFIC DOMAIN OR ADDRESS*/

postqueue -p | tail -n +2 | awk ‘BEGIN { RS = “” } /@domain.co.uk/ { print $1 }’ | tr -d ‘*!’ | postsuper -d -

postqueue -p | tail -n +2 | awk ‘BEGIN { RS = “” } /email_address@domain.co.uk/ { print $1 }’ | tr -d ‘*!’ | postsuper -d -

This article may help in connecting Postfix to registered users if you really want to go down that route. I haven’t tried it myself.

https://workaround.org/ispmail/jessie/relaying-smtp-authentication