I have Exim4 running on Debian configured to receive mail on multiple domains. Exim is set to forward all email that is received to one of the domains to another box. This box is configured with a catchall mailbox that everything goes in.
My issue is that when an email is sent to the domain, which contains a large amount of addresses (all to the same domain, but different users), Exim will receive the single email over multiple connections. This means that the catchall mailbox receives multiple copies of the single email all containing the full recipient list.
For example, I was able to reproduce it by sending an email from my gmail account that contained 500 recipients (eg firstname.lastname@example.org; email@example.com; firstname.lastname@example.org; etc. for a total of 500). Exim received the message as 20 messages (25 recipients per; appears to be a gmail server setting). So the catchall mailbox received 20 messages, each containing all 500 addresses.
I'm pretty sure I understand why this is happening but is there any way I can configure Exim to only receive it once, or to combine it into one? Is there anything that can be done on my end, or am I at the mercy of the sending email server?
This is causing havoc with a process that polls the catchall mailbox and parses each recipient in each email.
Update: Another possibility: Can I tell exim to only forward on the first of the messages and ignore the rest?
Update 2: How do I tell which recipients an email was meant for? So if exim receives a message for 500 recipients but is only meant for 25, how do I tell which 25 it was meant for? The closest thing I see in the message header is "Received: from SMTPD-FWD by " which is the first of the 25 recipients. Can I have exim insert all 25 into the header somehow?