From mlievaart@orion.nl Mon Jan 10 10:46:33 2000 From: Martijn Lievaart To: Eric S. Raymond Date: zondag 9 januari 2000 0:38 Subject: Re: Thanks for fetchmail and a solution to the multidrop problem (I Status: O Content-Length: 8086 Lines: 226 think) Hello Eric, Let me first state that I'm no sendmail nor unix guru, so although this seems to work, I certainly would not say this is the "best" solution. In fact I would welcome all comments to make this better. In particular, it seems that that the mailertable feature was made just for this, but I'm still studying that. Also, This mail will have lines wrapped. I will put up this on a website asap, so people can download the relevant portions. In the meantime, I'm using (stuck on) Outlook, so I won't even attempt to format this mail. Accept my apoligies and try to mentally reconnect the lines. Finally, this mail is a bit lengthy, but I guess it is better to get all information in, so please bear with me. After some very frustrating attempts to get multidrop to work reliably, it suddenly hit me. When sendmail has translated the recipient to the mailbox, the recipient is gone (in the cases we're talking about). So the solution is not to let sendmail do this translation (completely). The trick is to let a custom MDA be called with both the mailbox and the full recipient name. This MDA then just stuffs it in the correct mailbox after adding the appropriate headers. Luckily I hit on the formail utility. It reformats a mailmessage and does just what I wanted. Specifically my script uses it to: - add a custom header (default: "Delivered-To:") with the recipient - rewrite the message-ID, so fetchmail will download the same message multiple times. - add another header, just for fun. The rewriting of the message-ID is needed because fetchmail will suppress multiple messages with the same ID, normally a good idea, but now it gets in the way. A switch on fetchmail to suppress this behaviour would be great. At first I hardcoded the domains in the sendmail.cf, but I quickly set out to do one better and came up with the following solution. In sendmail.cf, add the following line somewhere at the top. Kmultidroptable hash -o /etc/mail/multidroptable this defines a table for all domains we want to use multidrop for. The format of this file is multiple lines of the format: e.g: mailtest.orion.nl mailtest mailtest2.orion.nl mailtest mailtest3.orion.nl mailtest bvh-communicatie.nl b.bvh krakatau.nl b.bvh personeelzaak.nl b.bvh maslowassociates.nl b.bvh rtij.nl rtij Of course, create a .db file with makemap. Also, the domains must be added to class w, so they should be added to your sendmail.cw or RelayTo file, or whatever you use. Now add to sendmail.cf: R$+ < @ $* . > $: $(multidroptable $2 $: $) $1 < @ $2 . > R $* $: $1 R $+ $+ < @ $* . > $#drop $@ $2 @ $3 $: $1 These lines should be above the existing lines that read: # short circuit local delivery so forwarded email works R$=L < @ $=w . > $#local $: @ $1 special local names R$+ < @ $=w . > $#local $: $1 regular local name This works as follows (in fact these comments are above my modification in our sendmail.cf). # # MLI. Any drop host gets passed to the drop script # # The first rule looks up the domain in the multidrop table. # The input at this point is always: # user@ # If found, the resulting lin