// this code is used for the SMTPAPI examples private static void Main() { // Create the email object first, then add the properties. var myMessage = new SendGridMessage(); myMessage.AddTo("*****@*****.**"); myMessage.From = new MailAddress("*****@*****.**", "John Smith"); myMessage.Subject = "Testing the SendGrid Library"; myMessage.Text = "Hello World! %tag%"; var subs = new List<String> { "私は%type%ラーメンが大好き" }; myMessage.AddSubstitution("%tag%",subs); myMessage.AddSection("%type%", "とんこつ"); SendAsync(myMessage); Console.ReadLine(); }
public void TestAddSection() { var header = new Header(); var sendgrid = new SendGridMessage(header); sendgrid.AddSection("tag", "value"); var json = header.JsonString(); Assert.AreEqual("{\"section\" : {\"tag\" : \"value\"}}", json); }