When using this mail approach from within an asp.net core project, the mail templates will use the shared (layout) components defined within the web project. As such, unexpected behaviour will result.
This should at least be documented.
Possible approaches in order to resolve:
- Try to separate the loaded views, and only load certain view assemblies (or app parts) for the mail dispatcher.
- Specifically define which layout file should be used