extract method of creating mail from template