I have a website that utilizes bootstrap along with a customized bootstrap theme. The website is designed to send notification emails to its users upon certain actions being triggered.
For these notification emails, I want the content to be in well-formatted HTML with the same aesthetic as the main website for consistency.
In order to maintain a clean and organized codebase, I am looking to embed the same bootstrap CSS used on the website directly into the email template. This way, if any changes are made to the website's theme, the notification emails will automatically update accordingly.
The challenge lies in reading the CSS file as a string, so it can be included in the email. My current approach involves referencing the CSS file within BundleConfig:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap-sandstone.css",
"~/Content/site.css"));
Thus, I attempted to read the CSS file using:
var css = File.ReadAllText(HttpContext.Current.Server.MapPath("~/Content/css"));
This resulted in a FileNotFound exception, highlighting the need for an alternative method.
Is there a solution that would allow me to input ~/Content/css
and retrieve the CSS contents?