(I started this draft before Nate responded)
Theme components only change the front end of Discourse (what you see in the browser); they do not change the backend which sends the email.
So the TOC in the email would have to be part of the post. You could include a section at the top. A few years ago a bookmarklet was shared that uses the headings in the post to generate that, so you can paste it into the post: I created a bookmarklet to create the table of content for forum posts.
You could hide that with a theme component or remove it after the emails have been sent to avoid users on the forum seeing both.
So you would
- publish the topic,
- use the bookmarklet to generate a TOC,
- edit the post to add it
- remove the TOC after the emails were sent (or use a component to hide the TOC in the forum)
I wonder if a workflow could handle that