[rt-users] Obtaining ticket ID from rt-mailgate in Procmail

W. Thornton Martin wtm2 at cornell.edu
Thu Oct 2 20:29:15 EDT 2008


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)
:0
{   
    # 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:
> 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,
>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
>   





More information about the rt-users mailing list