I am making a form that sends an email to the client, this email comes from a template depending on the stage of the client. Ex: Stage 01 sending the email with the body coming from template_01.html, if the client is in stage 04, sending the email with template_04.html
I'm doing a format that works, however as MVC is news to me, sometimes I think I'm doing it in hardcore form. Sometimes there is a simpler and unfamiliar means.
How do I do: Within the view in question I create a template_01.html file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<p>Prezado Cliente [Nome_Cliente],</p>
<p>Estamos lhe enviando o andamento do seu site conosco.</p>
<p>Novo status atualizado em:</p>
<p> [Mostra_EP] </p>
<p>[data]<p>
</body>
</html>
In the controller I called a library that I created that sends the email. First I read through FileSystem
var conteudo = System.IO.File.ReadAllText(Caminho);
Then I replace the fields [CustomerName], [Show_EP], [data]
conteudo = conteudo.Replace("[Nome_Cliente]", cliente.Nome);
conteudo = couteudo.Replace("[data],DateTime.Now);
In the [Show_EP] it is a bit more complex because I make a query in the database and a foreach and I'm putting together an html. after that I submit this content on:
objEmail.Body = conteudo;
Is there anything simpler? type a Partial that I calling it it would already return me an html already ready (it executes and returns an html) because the part of [Show_EP] is getting giant and I have not finished yet.