Variant ids in template names

Resolves TriggerMail/trigger_mail#1614.
Note that is required that variant ids should be of the form ```variant_<number>``` where number is an integer.