我无法使用c#中的sendgrid v3 api一致地使用单词替换工作。有时标签会被替换,其他时候则不会。我对此感到不知所措。任何人都可以在我的代码中看到明显的错误?Sendgrid c#模板替换
String apiKey = "KEY";
dynamic sg = new SendGridAPIClient(apiKey);
Email from = new Email("[email protected]");
String subject = "Hello World from the SendGrid CSharp Library";
Email to = new Email("[email protected]");
Content content = new Content("text/html", " ");
to.Name = "Joe";
Mail mail = new Mail(from, subject, to, content);
mail.TemplateId = "dfea45f3-d608-4860-9f38-c7d444qwrqwc1f";
Personalization subs = new Personalization();
subs.AddTo(to);
subs.AddSubstitution("*|url|*", "http://asdasdasd.com");
subs.AddSubstitution("*|username|*", "MrUsername");
mail.AddPersonalization(subs);
dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
嗨,你能解决这个问题吗?感谢您的答复!有同样的问题 –
不,我发电子邮件sendgrid,但没有回应。 – loveforfire33