procmail
[Top] [All Lists]

RE: Find recipient address then pipe that plus email out to a program

2005-05-24 13:34:00
At 13:57 2005-05-24 -0600, David Erickson wrote:
So IS there a way to get who the message is being delivered to and the
domain?  Is the $LOGNAME a reliable mailbox address?  If so then you could
probably just set a variable to hold your domain name that its being
delivered to?

$LOGNAME is the local username to which a message is being delivered on behalf of. Often, this has absolutely no bearing on the ADDRESS to which it is delivered to (say, if you have a user with multiple domains, or even simply aliases).

X-Envelope-To: (or Delivered-To:, etc), are headers which some MTAs either insert by default or can be convinced to insert. A caveat here is that say, with Sendmail, while it's easy to add the X-Envelope-To:, the program will NOT add it if there were more than one recipient to the message (via this host), and thus you cannot count on it always being there - this is the same logic which prevents the "for user(_at_)domain" clause from being inserted into the Received: header under the same conditions.

If you want to ensure that procmail is invoked with the username and domain, you'll have to set up aliases and virtusertable entries (in the case of Sendmail) for each such account to invoke procmail with that information. Unless you have very few users and aliases, this would be a mammoth task, obviously best handled via a script using a db to generate the bodies of these files (but well outside the scope of the procmail list -- your basic problem is with the MTA).

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>