【发布时间】:2020-12-15 15:41:27
【问题描述】:
我目前正在使用 SendGrid 的动态模板。我刚刚创建了一个新版本的模板,我想在开发中使用它。我找不到任何关于如何做到这一点的文档。 我正在使用 SendGrid 的 C# 库,这是我目前所拥有的。
var dynamicTemplateData = new Dictionary<string, string>
{
{"name", $"{user.FirstName}"},
{ "date", appointment.AppointmentDateTime.ToLocationDateTime(location.TimeZoneInformation).ToString("f") },
{"location", $"{location.Address} {location.Address2}. {location.City}, {location.State}"},
{"receipt_url", $"{_appSettings.SiteUrl}appointment/{appointment.Id}"},
{"order_id", $"{appointment.ExternalOrderId}"}
};
var msg = MailHelper.CreateSingleTemplateEmail(
new EmailAddress("mail@xxxx.com", "xxxx"),
new EmailAddress(user.EMail),
"d-adwadadadadadadadadadadad",
dynamicTemplateData);
【问题讨论】: