【发布时间】:2016-11-10 01:26:38
【问题描述】:
我无法让单词替换与 c# 中的 sendgrid v3 api 保持一致。有时标签会被替换,有时则不会。我不知道是什么原因造成的。任何人都可以在我的代码中看到任何明显的错误吗?
String apiKey = "KEY";
dynamic sg = new SendGridAPIClient(apiKey);
Email from = new Email("info@example.com");
String subject = "Hello World from the SendGrid CSharp Library";
Email to = new Email("example@gmail.com");
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 发了邮件,但还没有回复。