Hi,
can you provide more information?
How are you getting the mail? Are you doing it through browser or through an api?
you can use regex, get substring or get html for this.
Add for-next loop at beginning,
Embed rest of code in that loop and add
[[CYCLE_INDEX]] to {{link fo category}} like this >
{{link fo category}}[[CYCLE_INDEX]]