diff options
Diffstat (limited to 'examples/mail/mail.cs')
-rw-r--r-- | examples/mail/mail.cs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/mail/mail.cs b/examples/mail/mail.cs index 66e118b..64ec761 100644 --- a/examples/mail/mail.cs +++ b/examples/mail/mail.cs @@ -1,5 +1,6 @@ using System; using SendGrid.Helpers.Mail; // If you are using the Mail Helper +using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); @@ -168,6 +169,8 @@ string data = @"{ } } }"; +Object json = JsonConvert.DeserializeObject<Object>(data); +data = json.ToString(); dynamic response = sg.client.mail.send.post(requestBody: data); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Body.ReadAsStringAsync().Result); |