Seems to be complex, but its not that bad:

About $vars variable – in this one you can put everything which is set inside email template as variables.