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

I have a debian server set-up with sendmail and majordomo to handle incoming mail for some mailing-lists. Some of the users are in multiple lists and receive a mail twice when the mail is sent to both lists. Although not unexpected behavior it would be nice for these people to only receive the mail once.

So basically the question is: Is there a way to prevent sending a mail more then once to a recipient whom is in more then one (majordomo) list?

The strange thing is that I myself do not get the mail twice while using an internal user (as in part of the server) or when send to my student mail account. Somehow these servers filter out the duplicate mail.


A solution that could work for me is a way to rewrite the header when a message is send to list1@x.x and list2@x.x into list1and2@x.x. Where list1and2@x.x contains all members of list1 and list2 without duplicates.

share|improve this question
    
Tnx for the edits! –  Menno Feb 28 '13 at 16:57

1 Answer 1

In your majordomo source code distribution there exists Doc/majordomo.ora. There you will find a suggestion for running sendmail with the -odq switch in order to have sendmail queue first, instead of trying immediately to send them. So in your majordomo.cf have the following line:

$mailer = "$sendmail_command -oi -odq -oee -f\$sender";

Sendmail expands the list that it has to process and send mail to it. While it has expanded and started sending mail to the members of the first list, it will expand and send mail to members of the second list. Sendmail tries to identify identical messages so as to send them once per sender, but if some recipients both on list 1 are already processes while they are also on 2 before it is expanded, they will get it twice. So with -odq you place the message on the queue for both lists. If the message is the same for both, then the combined recipients will receive it once per user.

share|improve this answer
    
I tried a similar approach with the defer option (-odd), but this did not work. When I compare mailq when using -odq versus -odd i get the same result: owner-test@xxx.xx test-outgoing and of course its id and time. I would guess that it only works when the list is fully expended when queued but that does not seem to happen. I will test a bit more but I am guessing the result will be the same. –  Menno Mar 1 '13 at 18:42
    
This does not seem to work. When I use a gmail account in my test list, then I receive only one, but when I add a hotmail address it will still receive it twice when using the -odq option. –  Menno Mar 1 '13 at 19:21
    
You have to check the list expansion time in both your examples and then you will figure out why it was sent twice. It may also be the case that it got sent to Gmail twice but they have checked whether you have already received it. –  adamo Mar 2 '13 at 9:56
    
I am not sure how I should obtain that information. I did some testing however and it seems that majordomo queues the message with the sender: owner-test@xxx.xx and receiver test-outgoing. When I send mail directly to test-outgoing@xxx.xx and test2-outgoing@xxx.xx it seems to work and the mail gets filtered. So in a way majordomo queues one step to early. –  Menno Mar 3 '13 at 13:49

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.