So what happens when you step through the program, line by line? Seems the way to figure out which line is doing it.
I'm betting on the "success.aspx" page. I would also look at the email for some obviously static text, such as "Ticket #:" and then do a solution text search for that.