Sendgrid-csharp: Problem

Created on 4 Sep 2018  路  2Comments  路  Source: sendgrid/sendgrid-csharp

Good afternoon,

I'm trying to use sendgrid, but whenever I try to use a personalization I can not send, but when I remove the personalization I send it normally:

`

    var client = new SendGridClient(apiKey);

    var msg = new SendGridMessage()
    {
        From = new EmailAddress("[email protected]", "Equipe Easy"),
        Subject = subject,
        TemplateId = "d-ce99b65e0bed498fa6f83b715d2c10d7",
        Personalizations = new List<Personalization>()
        {
            new Personalization()
            {
                Substitutions = new Dictionary<string, string>()
                {
                    {"%linkConfirmacao%", link}
                }
            }
        }
    };

    msg.AddTo(new EmailAddress(email));

    return client.SendEmailAsync(msg);
}`

C# ASP.NET MV5 CORE 2;0

unknown or a waiting for feedback question

All 2 comments

Hi there,

When sending with Dynamic Templates, you'll have to use the parameter dynamic_template_data for all substitutions and Handlebar logic. If you're using the Legacy Templates, you can use the above call. Here is our documentation on using Dynamic Template Data.

https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/

Hello @matheusdelre,

Please update this SDK to version 9.10.0 and see this example.

Thanks!

With Best Regards,

Elmer

Was this page helpful?
0 / 5 - 0 ratings