我無法使用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