Obtaining ticket ID from rt-mailgate in Procmail

View: New views
2 Messages — Rating Filter:   Alert me  

Obtaining ticket ID from rt-mailgate in Procmail

by W. Thornton Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: Obtaining ticket ID from rt-mailgate in Procmail

by W. Thornton Martin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>  


_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@...


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
LightInTheBox - Buy quality products at wholesale price!