Q5036 - Exim/exim GitHub Wiki
Can I make Exim stop accepting inbound emails when the queue gets above some maximum number of emails?
There is no configuration setting which will do this, however you can do this with a macro and an ACL stanza.
# Global macro
QUEUE_SIZE_MAX = 1000
# Put in rcpt or predata ACL so sender and recipient are logged
defer set acl_c_queue_size = ${run {/usr/sbin/exim -bpc}}
condition = ${if gt{$acl_c_queue_size}{QUEUE_SIZE_MAX} {yes}{no}}