diff --git a/README.md b/README.md
index c23105b48..493468279 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,20 @@ Please browse the rest of this README for further detail.
We appreciate your continued support, thank you!
+# Table of Contents
+
+* [Installation](#installation)
+* [Quick Start](#quick_start)
+* [Usage](#usage)
+* [Use Cases](#use_cases)
+* [Announcements](#announcements)
+* [Roadmap](#roadmap)
+* [How to Contribute](#contribute)
+* [Troubleshooting](#troubleshooting)
+* [About](#about)
+
+
+
# Installation
## Prerequisites
@@ -45,6 +59,7 @@ using SendGrid.Helpers.Mail; // Include if you want to use the Mail Helper
- [SendGrid.CSharp.HTTP.Client](https://github.com/sendgrid/csharp-http-client)
- [Newtonsoft.Json](http://www.newtonsoft.com/json)
+
# Quick Start
## Hello Email
@@ -191,6 +206,7 @@ namespace Example
}
```
+
# Usage
- [SendGrid Docs](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html)
@@ -199,14 +215,22 @@ namespace Example
- [How-to: Migration from v2 to v3](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html)
- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/master/SendGrid/SendGrid/Helpers/Mail)
+
+# Use Cases
+
+[Examples of common API use cases](https://github.com/sendgrid/sendgrid-csharp/blob/master/USE_CASES.md), such as how to send an email with a transactional template.
+
+
# Announcements
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/sendgrid-csharp/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-csharp/releases).
+
# Roadmap
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/sendgrid/sendgrid-csharp/issues) and [pull requests](https://github.com/sendgrid/sendgrid-csharp/pulls). We would love to hear your feedback.
+
# How to Contribute
We encourage contribution to our library (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md) guide for details.
@@ -218,10 +242,12 @@ Quick links:
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md#cla)
- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-csharp/tree/master/CONTRIBUTING.md#improvements_to_the_codebase)
+
# Troubleshooting
Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-csharp/blob/master/TROUBLESHOOTING.md) for common library issues.
+
# About
sendgrid-csharp is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs
index 75c3b47ed..72bf4ef57 100644
--- a/SendGrid/Example/Example.cs
+++ b/SendGrid/Example/Example.cs
@@ -15,11 +15,84 @@ private static void Main()
HelloEmail().Wait(); // this will actually send an email
KitchenSink().Wait(); // this will only send an email if you set SandBox Mode to false
+ // v3 Template Example with Mail Helper
+ TemplateWithHelper().Wait();
+
+ // v3 Template Example without Mail Helper
+ TemplateWithoutHelper().Wait();
+
// v3 Web API
ApiKeys().Wait();
}
+ private static async Task TemplateWithHelper()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+
+ Email from = new Email("dx@sendgrid.com");
+ String subject = "I'm replacing the subject tag";
+ Email to = new Email("elmer@sendgrid.com");
+ Content content = new Content("text/html", "I'm replacing the body tag");
+ Mail mail = new Mail(from, subject, to, content);
+
+ mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
+ mail.Personalization[0].AddSubstitution("-name-", "Example User");
+ mail.Personalization[0].AddSubstitution("-city-", "Denver");
+
+ dynamic response = await sg.client.mail.send.post(requestBody: mail.Get());
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+
+ Console.ReadLine();
+
+ }
+
+ private static async Task TemplateWithoutHelper()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+
+ string data = @"{
+ 'personalizations': [
+ {
+ 'to': [
+ {
+ 'email': 'elmer@sendgrid.com'
+ }
+ ],
+ 'substitutions': {
+ '-name-': 'Example User',
+ '-city-': 'Denver'
+ },
+ 'subject': 'I\'m replacing the subject tag'
+ }
+ ],
+ 'from': {
+ 'email': 'dx@sendgrid.com'
+ },
+ 'content': [
+ {
+ 'type': 'text/html',
+ 'value': 'I\'m replacing the body tag'
+ }
+ ],
+ 'template_id': '13b8f94f-bcae-4ec6-b752-70d6cb59f932'
+ }";
+ //test @example.com
+ Object json = JsonConvert.DeserializeObject