procmail
[Top] [All Lists]

Re: Add Header to Carbon Copy

2003-07-30 10:39:25
At 12:06 2003-07-30 +0100, Dan Hardiker wrote:
We have a floating sales person, and a secetary and currently carbon copy all of the mail that ends up with the sales person to the secetary. I have yet to work out how to add a custom header to the forwarded email so it will appear only on that carboned email.

It might help if you describe your situation by way of an example of how the message would arrive at your server (if it IS your server and not just an account at an ISP, etc), and be forwarded.

The most appropriate method is to simply take the salesperson email alias (in the MTA config) and set it up to deliver to their user account AND to another user:

floatingsalesperson:    \floatingsalesperson,secretary

That's the most direct approach. It won't add any visible "cc:" header though, and since the original sender DIDN'T address it with one, that seems like the appropriate way to deal with it anyway. This approach is the most straightforward, and doesn't involve procmail at all (check with your MTA documentation at to how to compose an alias for it - the above is suitable for Sendmail).


Alternatley, you could use procmail, at the user's account:


:0c
* ! ^FROM_MAILER
* ! ^X-Loop: floatingsalesperson
{
        :0fhw
        | formail -A "X-Loop: floatingsalesperson"

        :0
        ! secretary
}

This says, "if the X-Loop header IS NOT equal to this text AND this isn't a mailer message (such as possibly, a bounce), let's take a (c)opy of the message and (f)ilter the (h)headers and (w)ait for the program and it's exit code, to (A)dd a custom header to the message, then forward (!) the message to the secretary."

Adding the header avoids mail loops caused by forwards which might be present on the other account.

---
 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(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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