procmail
[Top] [All Lists]

Re: sendmail & procmail - recipients

1996-09-16 17:32:23

This is probably more of a sendmail related question, but has been asked
several times in this group, so I hope nobody minds discussion of this
topic here.  When it is resolved, I think it will answer many procmail
questions also.


Brian Rankin <brankin(_at_)WestEd(_dot_)org> wrote:
[snip]
The solution:  Before passing incoming email to procmail, copy the envelope 
"To:" address to a unique header (I chose X-Full-Name:) and then modify the 
procmail recipe to look at this header.  Here's how I modified sendmail.cf:

a)  I added a flag called "x" to the procmail delivery agent, thus:

Mprocmail,      P=/usr/local/bin/procmail, F=mSDFMhunx, S=11, R=21,
                A=procmail -m $h $f $u

Notice the "x" in the F section - that's what I added.

b)  Then I added the custom header in the header section, thus:

H?x?X-Full-Name: $u

This tells sendmail to add this header line to a mail message if the delivery 
agent also contains the "x" flag.  The $u is a predefined sendmail macro that 
contains the envelope "To:" address.


This only "partly" works.  It has one major problem that I can't seem to fix.
If you mail to multiple recipients, it omits this header.

For example, I created a test domain called "dragons-test-domain.com" and
made the above modifications to my sendmail.cf.  When I email to:

  x(_at_)dragons-test-domain(_dot_)com

It works fine.  I get (I used X-Envelope-To instead of X-Full-Name):

From dant  Mon Sep 16 15:12:38 1996
X-Envelope-To: x(_at_)dragons-test-domain(_dot_)com
Subject: test
To: x(_at_)dragons-test-domain(_dot_)com

HOWEVER, if I email to:  
x(_at_)dragons-test-domain(_dot_)com,y(_at_)dragons-test-domain(_dot_)com

I get:

From dragon(_at_)mailhost(_dot_)cyberhighway(_dot_)net  Mon Sep 16 15:07:47 
1996
Subject: test
To: x(_at_)dragons-test-domain(_dot_)com, y(_at_)dragons-test-domain(_dot_)com

with no X-Envelope-To header.  I've seen in another post and in the
sendmail docs, that if you remove the "F=m" flag from your Mailer, it will
deliver the message once for each recipient, instead of just once for the
local user delivered too.

I removed the "m" flag, and I still only get one message.  

I've read at least 10 different web docs explaining how to do virtual email,
but EVERY one of them only says how to get mail into a single mailbox or 
to use dbm files maintained by the Mail admin.  Has anyone used procmail
successfully to where the domain owner can maintain thier own .procmailrc
AND have it work with multiple recipients and Bcc recipients?

I know it shouldn't be this difficult.

Dan T.