summaryrefslogtreecommitdiffstats
path: root/SendGrid/Example/Example.cs
diff options
context:
space:
mode:
authorArpit Jain <antimatter96@users.noreply.github.com>2016-07-21 12:32:29 +0530
committerGitHub <noreply@github.com>2016-07-21 12:32:29 +0530
commit9dd9ebbc6f68c7dec368169e29340df9537e759a (patch)
treec0da2a04429f92103cf8ed7c45944de2e7516426 /SendGrid/Example/Example.cs
parent4c8297a18d636721f878de003a9fffcbb0c618d0 (diff)
downloadsendgrid-csharp-9dd9ebbc6f68c7dec368169e29340df9537e759a.zip
sendgrid-csharp-9dd9ebbc6f68c7dec368169e29340df9537e759a.tar.gz
sendgrid-csharp-9dd9ebbc6f68c7dec368169e29340df9537e759a.tar.bz2
Added template example for sending mail with Mail Helper
Diffstat (limited to 'SendGrid/Example/Example.cs')
-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);