Variant ids in template names

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