I have a simple HTML code to send to a certain e-mail using C# API Sendgrid and Templates :
And when I try to see the preview of it looks as I expected :
But when the E-mail is delivered it doesn't recognize the "style" or any css code..
This is My Code :
static async Task Execute()
{
var apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");
var client = new SendGridClient(apiKey);
var msg = new SendGridMessage();
msg.SetFrom(new EmailAddress("test@example.com", "Example User"));
msg.SetSubject("I'm replacing the subject tag");
msg.AddTo(new EmailAddress("myEmail", "Nathiel"));
//msg.AddContent(MimeType.Text, "I'm replacing the <strong>body tag</strong>");
msg.SetTemplateId("MyTemplateId");
msg.AddSubstitution("-cepFrom-", "54315-310");
var response = await client.SendEmailAsync(msg);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Headers.ToString());
Console.WriteLine("\n\nPress any key to exit.");
Console.ReadLine();
}
I don't know what's wrong!