Use a table instead of multiple html with EmailService


I usually do this:

Email Service:

 public void NewScholarship(Boolean isApproved, String name, String classificationDescription, String percentage, String dateStarting, String dateEnding, String description)
        Subject = isApproved ? "¡Beca creada!" : "No se pudo crear la beca";
        var templateText = isApproved ? GetTemplateHtml("NewScholarship.html") : GetTemplateHtml("Declined.html");

        templateText = isApproved ? templateText
                .Replace("{Name}", name)
                .Replace("{Percentage}", percentage)
                .Replace("{DateStarting}", dateStarting)
                .Replace("{DateEnding}", dateEnding)
                .Replace("{ClassificationDescription}", classificationDescription)
            .Replace("{Description}", description);
        EmailBody = templateText;


 using (var emailService = new EmailsService())
            emailService.NewScholarship(false, student.Name, "", "", "", "", model.Description);
            emailService.SetSender(user, model.WithName);

After this I create an HTML template to send the mail (for each type of email). But my boss told me that this is not practical. And he told me to make a table and only an html file and depending on the user's request, the template will change the parameters.

For example, I have a Recovery Password and in my Html template I call these parameters:


And as I said before, I usually make another Html file for my Create Account, and I call these parameters:


But what my boss wants is that he only make an HTML file, and manage everything from the service and / or the controller. How do I send the parameters so that my template changes depending on the action? either CreateAccount or RecoveryPassword?

asked by Edgar G 06.06.2016 в 04:10

0 answers