At 15:52 2002-07-21 -0400, Kevin S. Brackett did say:
I have a ticketing support system in place, with multiple addresses going
to single departments, now, to keep track of these requests i'd like to
add a text tag to the subject header of the emails coming in...
Ie, user sends email to blah78682682(_at_)domain
and the tag [78682682]: to be added to the subject header of those
emails while still keeping the original subject intact
so my question is this...
How do I alter the subject by taking a few characters of the ^To: header
address and then have it forward to another address (the actual
ticketing system address) while still keeping the ^From: address the same?
_Forwarding_ doesn't change the From:. It _does_ change the envelope-from
however.
I was thinking about doing this all from the site wide procmailrc since
these are only aliases... so any pointers?
in your sendmail aliases file (in place of a simple alias definition to the
"real" support address):
supportsomenumber: "|/path/procmail -m /etc/procmailrcs/somercfile.rc
somenumber"
(do that for each of your aliases)
in the somercfile.rc:
# this is *ONLY* invoked for those accounts which specify this rcfile
# NOT for other generic accounts.
# since the TO: address may not be cleartexted to us, we use $1 for the number
# parameter
ADDRNUM=$1
# extract the original subject (this also eliminates leading whitespace)
:0
* ^Subject:[ ]*\/[^ ].*
{
SUBJECT=$MATCH
}
# create the new subject token
SUBJECT="[$ADDRNUM]: $MATCH"
# insert it into the headers
:0hf
| formail -I "Subject: $SUBJECT"
# and forward
:0
! realsupportaddr
(those last two steps could be combined by eliminating the 'hf' and piping
the output of formail into "$SENDMAIL realsupportaddr", but I prefer the
above split approach in most cases).
In any situation where you forward messages, you should consider adding
loop detection.
---
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