diff options
author | Arpit Jain <antimatter96@users.noreply.github.com> | 2016-07-21 12:32:29 +0530 |
---|---|---|
committer | Maxim Dubrovkin <maximdubrovkin@Maxims-MBP.Dlink> | 2016-09-20 20:10:58 +0500 |
commit | 9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3 (patch) | |
tree | c408fe6631393ceb7a17bdc269639093e5ae7fa5 /SendGrid/Example/Example.cs | |
parent | cb3319387b20d9cd433b74b80b56ab6caa3e0db5 (diff) | |
download | sendgrid-csharp-9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3.zip sendgrid-csharp-9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3.tar.gz sendgrid-csharp-9f91f7e1a7cbd9cb16fdfa0e8138f0de61a98fc3.tar.bz2 |
Added template example for sending mail with Mail Helper
Diffstat (limited to 'SendGrid/Example/Example.cs')
-rw-r--r-- | SendGrid/Example/Example.cs | 11 |
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); |