procmail
[Top] [All Lists]

Re: Problems with mailing lits

1998-05-13 23:00:08
On Wed, 13 May 1998, Bill McClatchie wrote:
On Tue, 12 May 1998, Christopher Lindsey wrote:
The problem is, when user2 subscribes to a mailing list, there
is no "TO" line in the header and all mail from the list will
go to DEAFULT. 

How can I match the "Received ...  for <user2(_at_)mydomain(_dot_)de>" 
line?

I don't know if this will be useful in your situation, but if not, maybe
someone will find it useful. I use a short shell-script to find the 'for'
recipient in the topmost received line. 

        RCVD_FOR=`formail -ureceived -xreceived|sed -e 's/[>]*[;].*$//' \
                -e 's/^.*[       ][<]*//' -e '/^[^(_at_)]*$/d' -e '/^[^.]*$/d'`

"Received:" fields seem to vary a bit. Rather than looking for a word
following "for", I get the word ending in ";", strip it of any
angle-brackets, and if it contains both an "@" and a ".", then I'll take
it as an address. In the above script the var will be empty if no address
is found. 

I'm currently using this on two user accounts that forward virtual-domain
mail to other addresses, along with other tests if the above test comes up
empty. 

The bug is that if the mail is for more than one user (local to the
account doing the forwarding) then there is no recipient in the top
"Received:" line at all. Ideally, one needs to look at the envelope, which
is unavailable to me. But so far this is working for me, because it seems
that the mailinglist mail arrives in my user-accounts in multiple copies,
one for each subscriber, and they all have a different address in the
"Received:" line.

David Hunt