procmail
[Top] [All Lists]

Re: Using an alias file to copy/forward mail to other addresses

2005-08-03 15:24:43
At 23:02 2005-08-03 +0300, Udi Mottelo wrote:
Problem: if you have multiple recipients on messages, you're going to need
to perform lookups against that file multiple times - one for each apparent
recipient of the message.  That also means you need to parse the message
for recipients and extract them to a variable and walk through that 
variable.

        Thats challenge.  I think that X-Original-To hold only one
        address.

Indeed, X-Envelope-To: (when configured to be inserted by Sendmail - it 
isn't a default header) is only inserted when there's a SINGLE local 
recipient - multiple recipients cause the header to NOT be included.  Refer 
to the procmail mantra.

        There are three problems with grep.  (1) The output includes
        the word that you are looking for and we want only the address
        after the first word.

         Addresses.  There might be more than one.

         The MATCH operation which follows the grep deals with that however.

  (2) grep can give you more then one
        output, for example:  sara(_at_)abcd(_dot_)co  will give you lines 
with
        sara(_at_)abcd(_dot_)com (you can solve it with "-w" flag).

         OR, if you examined the regexp I presented, you anchor to the 
beginning
         of the line *AND* include the whitespace separator which should follow
         the token you're matching for.  Result: no under or over matching.

  (3) From
        previous example: sara(_at_)abcd(_dot_)co can be one of the forward 
address
        fields.

         See response to #2 - anchored to the beginning of the line, this isn't
         a problem.

IME, the size and complexity of awk has generally made it a slower 
processor, esp for something so simple.

---
  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