summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpit Jain <antimatter96@users.noreply.github.com>2016-07-21 12:32:29 +0530
committerMaxim Dubrovkin <maximdubrovkin@Maxims-MBP.Dlink>2016-09-20 20:10:58 +0500
commit9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3 (patch)
treec408fe6631393ceb7a17bdc269639093e5ae7fa5
parentcb3319387b20d9cd433b74b80b56ab6caa3e0db5 (diff)
downloadsendgrid-csharp-9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3.zip
sendgrid-csharp-9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3.tar.gz
sendgrid-csharp-9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3.tar.bz2
Added template example for sending mail with Mail Helper
-rw-r--r--SendGrid/Example/Example.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs
index 133160f..7af92be 100644
--- a/SendGrid/Example/Example.cs
+++ b/SendGrid/Example/Example.cs
@@ -31,7 +31,16 @@ namespace Example
Mail mail = new Mail(from, subject, to, content);
Email email = new Email("test2@example.com");
mail.Personalization[0].AddTo(email);
-
+
+ //If you want to use a tempalte
+ //Adding this will replace the above added subject and content
+ mail.TemplateId = "TEMPLATE_ID";
+ mail.Personalization[0].AddSubstitution("[KEY_1]", "VALUE_1");
+ mail.Personalization[0].AddSubstitution("[KEY_2]", "VALUE_1");
+
+
+
+
dynamic response = sg.client.mail.send.post(requestBody: mail.Get());
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);