Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 a@example.com; b@example.com; c@example.com; 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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The default configuration for Exim is to allow unlimited recipients per message. This is controlled by the recipients_max parameter. If you are getting less, then either your configuration is limiting recipients, or the problem is upstream.

As you have probably noticed Exim will only deliver once when multiple expansions create the same delivery address for a message. It just doesn't work that way across messages.

The message_id should be the same for all these messages, you might want to use procmail or a similar program to file the duplicates in a different folder. There are examples available online that do things similar to what you want to do.

EDIT: You may be able get Exim use a milter to do filter out the duplicates. If you have database access enabled, you could build a filter in the data acl to detect the duplicates. However, it may be better to use a more specialized MDA like procmail to deliver messages to the catchall address. Exim plays well with procmail with the MDA for some or all users.

There are existing recipes that handle duplicate messages. Timo has a procmail rule to check for Duplicate messages sent is rapid succession. This should handle cases where the message_id of the message changes.

share|improve this answer
    
Yeah, recipients_max is set to unlimited, I also set max_rcpt = 0 in the remote_smtp transport. The message id is not the same for each message, however. I will look into procmail and see if it will help. I'm still not sure if anything can be done on my end, or if the issue is "upstream" on the remote email server. –  AceJordin Nov 15 '11 at 16:11
    
If you have different message_ids, I would expect the problem to be upstream. –  BillThor Nov 15 '11 at 16:47
    
I think you're right, all my tests indicate that exim has no control over how many "chunks" the remote email server sends a message in. (For example it appears the Comcast Web Client doesn't batch at all and sends each recipient on its own.) Also, while each chunk has it's own unique exim id (ex: 1RQNSI-00019N-FL), the id is the same (ex: CAM-blah_blahblahblah@mail.gmail.com) for each chunk. So perhaps I can get exim to only forward once per id? Not sure how though. –  AceJordin Nov 15 '11 at 18:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.