public TemplateInfo GetTemplateInfo(string slugId) { var template = _api.TemplateInfo(slugId); if (template != null) { return(template); } return(null); }
public async Task Should_Get_Template_Info() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string templateName = Guid.NewGuid().ToString(); const string code = "Foobar"; // Exercise var api = new MandrillApi(apiKey); await api.AddTemplate(new AddTemplateRequest(templateName) { FromName = "*****@*****.**", Code = code, Text = code, Publish = true }); TemplateInfo result = await api.TemplateInfo(new TemplateInfoRequest(templateName)); // Verify Assert.AreEqual(templateName, result.Name); Assert.AreEqual(code, result.Code); // Cleanup await api.DeleteTemplate(new DeleteTemplateRequest(templateName)); }
public void Can_Return_Individial_Template() { // Setup var apiKey = ConfigurationManager.AppSettings["APIKey"]; var templateName = ConfigurationManager.AppSettings["TemplateExample"]; // Exercise var api = new MandrillApi(apiKey); var result = api.TemplateInfo(templateName); var expected = "<span mc:edit=\"model1\"></span>"; // Verify Assert.AreEqual(expected, result.code); }
public async Task Should_Get_Template_Info() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string templateName = ConfigurationManager.AppSettings["TemplateExample"]; string expectedTemplate = "<span mc:edit=\"model1\"></span>"; // Exercise var api = new MandrillApi(apiKey); TemplateInfo result = await api.TemplateInfo(new TemplateInfoRequest(templateName)); // Verify Assert.AreEqual(templateName, result.Name); Assert.AreEqual(expectedTemplate, result.Code); }
public String EmailAccountActivation(String email, String url, String name) { string result = "error"; try { UserInfo user = new UserInfo(); Mandrill.Models.TemplateInfo template = apimd.TemplateInfo("Correo_verificacion"); Mandrill.EmailMessage msg = new Mandrill.EmailMessage { from_email = "*****@*****.**" , from_name = "YoVendoRecarga.com" , auto_text = false , subject = "Activar Cuenta" , to = new List <Mandrill.EmailAddress> { new Mandrill.EmailAddress(email, name, "to") } , bcc_address = "*****@*****.**" , merge_language = "mailchimp" , merge = true }; msg.AddGlobalVariable("NAME", name); msg.AddGlobalVariable("LINK", url); apimd.SendMessage(msg, template.name, null); } catch (Exception) { result = "error"; throw; } return(result); }