コード例 #1
0
 public static Task SendEdm(string culture, string template, JObject data, string subject, string from)
 {
     return(Task.Run(() => {
         if (!string.IsNullOrEmpty(data["email"].Value <string>()))
         {
             string to = data["email"].Value <string>();
             var getEdm = ViewModels.MixTemplates.UpdateViewModel.GetTemplateByPath(template, culture);
             if (getEdm.IsSucceed && !string.IsNullOrEmpty(getEdm.Data.Content))
             {
                 string body = getEdm.Data.Content;
                 foreach (var prop in data.Properties())
                 {
                     body = body.Replace($"[[{prop.Name}]]", data[prop.Name].Value <string>());
                 }
                 MixService.SendMail(subject, body, to, from);
             }
         }
     }));
 }