Question: I have spammers sending multiple email messages to my mail server. How can can I limit the number of emails they can send in a given amount of time?
Answer: This is a trick that many spammers and malicious hackers will use to flood your server with their nonsense. Although a spam blocker will certainly help, it still has to process each email. If thousands of emails are sent an hour, that takes up valuable CPU power, memory, disk space, and time.
Postfix mail server allows you to limit the rate of incoming emails, keeping the spam messages from flooding your server. To configure it, edit /etc/mail/main.cf:
# nano main.cf (or vi main.cf)
Add the following directives:
smtpd_error_sleep_time = 1s
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 20
With these settings, after a client has made 10 connections, Postfix will pause and delay the next connection. If the connection is made 20 times without delivering mail, Postfix will disconnect.