Obtaining ticket ID from rt-mailgate in Procmail

I am calling rt-mailgate from Procmail and need to capture the ticket id
of the ticket it creates. The tickets are created correctly, but I need
this ticket id to pass to another script in Procmail.

Does anyone have an example of this?

Thank you,

I worked things out by using the rt-mailgate --debug option, which
returns the ticket number as part of its output. This is what I see in
the third line:.

,okTicket: 105Queue: Owner:,NobodyStatus: Subject:,Requestor:

pipe stderr to rt-mailgate & grab ticket ID (need to redirect stderr

in order for sed to access it)
# put into RT (preserve ticket number).
:0fw c
TICKET=/opt/local/rt/bin/rt-mailgate --debug --extension ticket --queue ${RTQUEUE} --action correspond --url ${RT_URL} 3>&1 1>&2 2>&3|/usr/bin/sed -e '1,3d' -e 's/^\(.*Ticket:[ ]*\)\([0-9]\{1,\}\)\(.*\)\$/\2/'

Perhaps someone can think of an alternate solution, but this works
reliably for me.

W. Thornton Martin wrote: