Hi,
I am configuring virtualmin for my new server because old server was hacked and thus blacklisted due to mass email sending.
I am looking for a way like if any script is trying to send email them postfix can check if "FROM" header, if matched with hosted domain else, reject the email.
Example: Let's say example.com is hosted on my Virtualmin server
- Postfix should allow to send emails if mail() header has
"From: admin@example.com"
or "From: anything@example.com"
or "From: anything@stage.example.com"
- Postfix should reject emails if mail() header has
"From: admin@test.com"
or "From: anything@gmail.com"
or any other domain which isn't hosted on my server.
Also, it there any way I can set mail sending limit per hour for any domain/server?
Note:
I have already configured SPF, DKIM and DMARC and logging the path of any files from emails would be sending so that I can track them:
mail.add_x_header = On
mail.log = /var/log/phpmail_files.log