This has been described several times. Just look through the mods. Even the thread you pointed at has a link to http://osticket.com/forums/showthread.php?t=2218(http://osticket.com/forums/showthread.php?t=2218) which describes a mod.
Anyway, note that the particular solution depends on how you have set up the mail input chain (email piping, POP3/IMAP fetching, ..). If you use api/pipe.php the essiantial parts are rather simple.
If you search the forum for the keywords mismatched, emails, and hell (all together) you'll find a solution for sure.
HTH.