summaryrefslogtreecommitdiffstats
path: root/SendGrid/Example
diff options
context:
space:
mode:
Diffstat (limited to 'SendGrid/Example')
-rw-r--r--SendGrid/Example/Example.cs333
-rw-r--r--SendGrid/Example/Example.csproj19
-rw-r--r--SendGrid/Example/Program.cs263
-rw-r--r--SendGrid/Example/WEBAPI.cs544
-rw-r--r--SendGrid/Example/app.config20
-rw-r--r--SendGrid/Example/packages.config3
6 files changed, 354 insertions, 828 deletions
diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs
new file mode 100644
index 0000000..43ca32f
--- /dev/null
+++ b/SendGrid/Example/Example.cs
@@ -0,0 +1,333 @@
+using System;
+using System.Collections.Generic;
+using System.Web.Script.Serialization;
+using SendGrid.Helpers.Mail;
+
+namespace Example
+{
+ internal class Example
+ {
+ private static void Main()
+ {
+ // v3 Mail Helper
+ HelloEmail();
+ KitchenSink();
+
+ // v3 Web API
+ ApiKeys();
+
+ }
+
+
+ private static void HelloEmail()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://3wyb2hp7emnqja6ys.stoplight-proxy.io");
+
+ Mail mail = new Mail();
+
+ Email email = new Email();
+ email.Address = "dx@sendgrid.com";
+ mail.From = email;
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Address = "elmer.thomas@sendgrid.com";
+ personalization.AddTo(email);
+ personalization.AddHeader("X-Mock", "True");
+ mail.AddPersonalization(personalization);
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Content content = new Content();
+ content.Type = "text/plain";
+ content.Value = "Textual content";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/html";
+ content.Value = "<html><body>HTML content</body></html>";
+ mail.AddContent(content);
+
+ String ret = mail.Get();
+
+ string requestBody = ret;
+ dynamic response = sg.client.mail.send.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+
+ Console.WriteLine(ret);
+ Console.ReadLine();
+
+ }
+
+ private static void KitchenSink()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://3wyb2hp7emnqja6ys.stoplight-proxy.io");
+
+ Mail mail = new Mail();
+
+ Email email = new Email();
+ email.Name = "DX";
+ email.Address = "dx@sendgrid.com";
+ mail.From = email;
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Name = "Elmer Thomas";
+ email.Address = "elmer.thomas@sendgrid.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Matt Bernier";
+ email.Address = "matt.bernier@sendgrid.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Eric Shallock";
+ email.Address = "eric.shallock@sendgrid.com";
+ personalization.AddCc(email);
+ personalization.AddBcc("elmer.thomas+secret@sengrid.com");
+ personalization.AddBcc("elmer.thomas+secret@elmer.thomas.com");
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Elmer");
+ personalization.AddSubstitution("%city%", "Moreno Valley");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ personalization = new Personalization();
+ email = new Email();
+ email.Name = "Elmer Thomas";
+ email.Address = "elmer.thomas@gmail.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Matt Bernier";
+ email.Address = "matt.bernier@sendgrid.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Eric Shallock";
+ email.Address = "eric.shallock@sendgrid.com";
+ personalization.AddCc(email);
+ personalization.AddBcc("elmer.thomas+secret@sengrid.com");
+ personalization.AddBcc("elmer.thomas+secret@elmer.thomas.com");
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Elmer");
+ personalization.AddSubstitution("%city%", "Moreno Valley");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ Content content = new Content();
+ content.Type = "text/plain";
+ content.Value = "Textual content";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/html";
+ content.Value = "<html><body>HTML content</body></html>";
+ mail.AddContent(content);
+ content = new Content();
+ content.Type = "text/calendar";
+ content.Value = "Party Time!!";
+ mail.AddContent(content);
+
+ Attachment attachment = new Attachment();
+ attachment.Content = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12";
+ attachment.Type = "application/pdf";
+ attachment.Filename = "balance_001.pdf";
+ attachment.Disposition = "attachment";
+ attachment.ContentId = "Balance Sheet";
+ mail.AddAttachment(attachment);
+
+ attachment = new Attachment();
+ attachment.Content = "iVBORw0KGgoAAAANSUhEUgAAAlgAAAC0CAMAAAB/oaI+AAACvlBMVEX///8aguLp8/wmiOMnieQ5k+bg7vtcpury+P0/lufX6foehOJCmOe92/er0fRToen9/v8hhuNkquvG4PjP5fkihuMjh+Mkh+MtjOQzkOVusO12tO77/f/8/v8cg+IfheMwjuVFmud/ue/+///t9f3u9v33+/5Wo+ppreyUxfGjzfP7/f4bguIri+QsjOQ8leY9leZdp+v6/P4ehONKnOhmrOx+uO+IvvCRw/Hc7Pvm8fzr9PwgheNHm+iayPKfy/PF3/jH4fji7/vo8vz1+v4ujeU0kOU6lOZIm+hSoOl4te601va62fbv9v3w9/30+f75/P4piuQyj+U2keZGmuhLnejE3/fZ6vodg+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EAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCATC/1P8HzJOjPJg+R84AAAAAElFTkSuQmCC";
+ attachment.Type = "image/png";
+ attachment.Filename = "banner.png";
+ attachment.Disposition = "inline";
+ attachment.ContentId = "Banner";
+ mail.AddAttachment(attachment);
+
+ mail.TemplateId = "13b8f94f-bcae-4ec6-b752-70d6cb59f932";
+
+ mail.AddHeader("X-Day", "Monday");
+ mail.AddHeader("X-Month", "January");
+
+ mail.AddSection("%section1", "Substitution for Section 1 Tag");
+ mail.AddSection("%section2", "Substitution for Section 2 Tag");
+
+ mail.AddCategory("customer");
+ mail.AddCategory("vip");
+
+ mail.AddCustomArgs("campaign", "welcome");
+ mail.AddCustomArgs("sequence", "2");
+
+ ASM asm = new ASM();
+ asm.GroupId = 3;
+ List<int> groups_to_display = new List<int>()
+ {
+ 1, 4, 5
+ };
+ asm.GroupsToDisplay = groups_to_display;
+ mail.Asm = asm;
+
+ mail.SendAt = 1461775051;
+
+ mail.SetIpPoolId = "23";
+
+ mail.BatchId = "some_batch_id";
+
+ MailSettings mailSettings = new MailSettings();
+ BCCSettings bccSettings = new BCCSettings();
+ bccSettings.Enable = true;
+ bccSettings.Email = "dx@sendgrid.com";
+ mailSettings.BccSettings = bccSettings;
+ BypassListManagement bypassListManagement = new BypassListManagement();
+ bypassListManagement.Enable = true;
+ mailSettings.BypassListManagement = bypassListManagement;
+ FooterSettings footerSettings = new FooterSettings();
+ footerSettings.Enable = true;
+ footerSettings.Text = "Some Footer Text";
+ footerSettings.Html = "<bold>Some HTML Here</bold>";
+ mailSettings.FooterSettings = footerSettings;
+ SandboxMode sandboxMode = new SandboxMode();
+ sandboxMode.Enable = false;
+ mailSettings.SandboxMode = sandboxMode;
+ SpamCheck spamCheck = new SpamCheck();
+ spamCheck.Enable = true;
+ spamCheck.Threshold = 1;
+ spamCheck.PostToUrl = "https://gotchya.example.com";
+ mailSettings.SpamCheck = spamCheck;
+ mail.MailSettings = mailSettings;
+
+ TrackingSettings trackingSettings = new TrackingSettings();
+ ClickTracking clickTracking = new ClickTracking();
+ clickTracking.Enable = false;
+ clickTracking.EnableText = false;
+ trackingSettings.ClickTracking = clickTracking;
+ OpenTracking openTracking = new OpenTracking();
+ openTracking.Enable = true;
+ openTracking.SubstitutionTag = "Optional tag to replace with the open image in the body of the message";
+ trackingSettings.OpenTracking = openTracking;
+ SubscriptionTracking subscriptionTracking = new SubscriptionTracking();
+ subscriptionTracking.Enable = true;
+ subscriptionTracking.Text = "text to insert into the text/plain portion of the message";
+ subscriptionTracking.Html = "<bold>HTML to insert into the text/html portion of the message</bold>";
+ subscriptionTracking.SubstitutionTag = "text to insert into the text/plain portion of the message";
+ trackingSettings.SubscriptionTracking = subscriptionTracking;
+ Ganalytics ganalytics = new Ganalytics();
+ ganalytics.Enable = true;
+ ganalytics.UtmCampaign = "some campaign";
+ ganalytics.UtmContent = "some content";
+ ganalytics.UtmMedium = "some medium";
+ ganalytics.UtmSource = "some source";
+ ganalytics.UtmTerm = "some term";
+ trackingSettings.Ganalytics = ganalytics;
+ mail.TrackingSettings = trackingSettings;
+
+ email = new Email();
+ email.Address = "dx@sendgrid.com";
+ mail.ReplyTo = email;
+
+ String ret = mail.Get();
+
+ string requestBody = ret;
+ dynamic response = sg.client.mail.send.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+
+ Console.WriteLine(ret);
+ Console.ReadLine();
+ }
+
+ private static void ApiKeys()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://e9sk3d3bfaikbpdq7.stoplight-proxy.io");
+
+ string queryParams = @"{
+ 'limit': 100
+ }";
+ dynamic response = sg.client.api_keys.get(queryParams: queryParams);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to POST.");
+ Console.ReadLine();
+
+ // POST
+ string requestBody = @"{
+ 'name': 'My API Key 5',
+ 'scopes': [
+ 'mail.send',
+ 'alerts.create',
+ 'alerts.read'
+ ]
+ }";
+ response = sg.client.api_keys.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+ JavaScriptSerializer jss = new JavaScriptSerializer();
+ var ds_response = jss.Deserialize<Dictionary<string, dynamic>>(response.ResponseBody.ReadAsStringAsync().Result);
+ string api_key_id = ds_response["api_key_id"];
+
+ Console.WriteLine("\n\nPress any key to continue to GET single.");
+ Console.ReadLine();
+
+ // GET Single
+ response = sg.client.api_keys._(api_key_id).get();
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to PATCH.");
+ Console.ReadLine();
+
+ // PATCH
+ requestBody = @"{
+ 'name': 'A New Hope'
+ }";
+ response = sg.client.api_keys._(api_key_id).patch(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to PUT.");
+ Console.ReadLine();
+
+ // PUT
+ requestBody = @"{
+ 'name': 'A New Hope',
+ 'scopes': [
+ ' user.profile.read',
+ ' user.profile.update'
+ ]
+ }";
+ response = sg.client.api_keys._(api_key_id).put(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseBody.ReadAsStringAsync().Result);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+
+ Console.WriteLine("\n\nPress any key to continue to DELETE.");
+ Console.ReadLine();
+
+ // DELETE
+ response = sg.client.api_keys._(api_key_id).delete();
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.ResponseHeaders.ToString());
+
+ Console.WriteLine("\n\nPress any key to exit.");
+ Console.ReadLine();
+
+ }
+ }
+}
diff --git a/SendGrid/Example/Example.csproj b/SendGrid/Example/Example.csproj
index 786d6fb..038265c 100644
--- a/SendGrid/Example/Example.csproj
+++ b/SendGrid/Example/Example.csproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition="'$(Platform)' == '' ">x86</Platform>
@@ -8,7 +8,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Example</RootNamespace>
<AssemblyName>Example</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -45,9 +45,13 @@
</DefineConstants>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="CSharpHTTPClient, Version=1.0.2.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
+ <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.1.0.2\lib\CSharpHTTPClient.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="Microsoft.CSharp" />
- <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
@@ -61,9 +65,8 @@
<Reference Include="System.Web.Extensions" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Program.cs" />
+ <Compile Include="Example.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="WebApi.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
@@ -75,10 +78,6 @@
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\SendGridMail\Mail.csproj">
- <Project>{3c687bef-ff50-44ad-8315-2d4237281af8}</Project>
- <Name>Mail</Name>
- </ProjectReference>
<ProjectReference Include="..\SendGrid\SendGrid.csproj">
<Project>{1c318867-440b-4eb9-99e3-c0cc2c556962}</Project>
<Name>SendGrid</Name>
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs
deleted file mode 100644
index 447bd04..0000000
--- a/SendGrid/Example/Program.cs
+++ /dev/null
@@ -1,263 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Net.Mail;
-using Newtonsoft.Json.Linq;
-
-namespace Example
-{
- internal class Program
- {
- private static void Main()
- {
- // Test sending email
- var to = "example@example.com";
- var from = "example@example.com";
- var fromName = "Jane Doe";
- SendEmail(to, from, fromName);
- // Test viewing, creating, modifying and deleting API keys through our v3 Web API
- ApiKeys();
- UnsubscribeGroups();
- Suppressions();
- GlobalSuppressions();
- GlobalStats();
- }
-
- private static void SendAsync(SendGrid.SendGridMessage message)
- {
- string apikey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
- // Create a Web transport for sending email.
- var transportWeb = new SendGrid.Web(apikey);
-
- // Send the email.
- try
- {
- transportWeb.DeliverAsync(message).Wait();
- Console.WriteLine("Email sent to " + message.To.GetValue(0));
- Console.WriteLine("\n\nPress any key to continue.");
- Console.ReadKey();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- Console.WriteLine("\n\nPress any key to continue.");
- Console.ReadKey();
- }
- }
-
- private static void SendEmail(string to, string from, string fromName)
- {
- // Create the email object first, then add the properties.
- var myMessage = new SendGrid.SendGridMessage();
- myMessage.AddTo(to);
- myMessage.From = new MailAddress(from, fromName);
- myMessage.Subject = "Testing the SendGrid Library";
- myMessage.Text = "Hello World! %tag%";
-
- var subs = new List<String> { "私は%type%ラーメンが大好き" };
- myMessage.AddSubstitution("%tag%", subs);
- myMessage.AddSection("%type%", "とんこつ");
-
- SendAsync(myMessage);
- }
-
- private static void ApiKeys()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // GET API KEYS
- HttpResponseMessage responseGet = client.ApiKeys.Get().Result;
- Console.WriteLine(responseGet.StatusCode);
- Console.WriteLine(responseGet.Content.ReadAsStringAsync().Result);
- Console.WriteLine("These are your current API Keys.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // POST API KEYS
- HttpResponseMessage responsePost = client.ApiKeys.Post("CSharpTestKey").Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- var apiKeyId = jsonObject.api_key_id.ToString();
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("API Key created.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // PATCH API KEYS
- HttpResponseMessage responsePatch = client.ApiKeys.Patch(apiKeyId, "CSharpTestKeyPatched").Result;
- Console.WriteLine(responsePatch.StatusCode);
- Console.WriteLine(responsePatch.Content.ReadAsStringAsync().Result);
- Console.WriteLine("API Key patched.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE API KEYS
- Console.WriteLine("Deleting API Key, please wait.");
- HttpResponseMessage responseDelete = client.ApiKeys.Delete(apiKeyId).Result;
- Console.WriteLine(responseDelete.StatusCode);
- HttpResponseMessage responseFinal = client.ApiKeys.Get().Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- Console.WriteLine("API Key Deleted.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void UnsubscribeGroups()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // GET UNSUBSCRIBE GROUPS
- HttpResponseMessage responseGet = client.UnsubscribeGroups.Get().Result;
- Console.WriteLine(responseGet.StatusCode);
- Console.WriteLine(responseGet.Content.ReadAsStringAsync().Result);
- Console.WriteLine("These are your current Unsubscribe Groups. Press any key to continue.");
- Console.ReadKey();
-
- // GET A PARTICULAR UNSUBSCRIBE GROUP
- int unsubscribeGroupID = 69;
- HttpResponseMessage responseGetUnique = client.UnsubscribeGroups.Get(unsubscribeGroupID).Result;
- Console.WriteLine(responseGetUnique.StatusCode);
- Console.WriteLine(responseGetUnique.Content.ReadAsStringAsync().Result);
- Console.WriteLine("This is an Unsubscribe Group with ID: " + unsubscribeGroupID.ToString() + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- // POST UNSUBSCRIBE GROUP
- HttpResponseMessage responsePost = client.UnsubscribeGroups.Post("C Sharp Unsubscribes", "Testing the C Sharp Library", false).Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- var unsubscribeGroupId = jsonObject.id.ToString();
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Unsubscribe Group created.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE UNSUBSCRIBE GROUP
- Console.WriteLine("Deleting Unsubscribe Group, please wait.");
- HttpResponseMessage responseDelete = client.UnsubscribeGroups.Delete(unsubscribeGroupId).Result;
- Console.WriteLine(responseDelete.StatusCode);
- HttpResponseMessage responseFinal = client.UnsubscribeGroups.Get().Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Unsubscribe Group Deleted.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void Suppressions()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // GET SUPPRESSED ADDRESSES FOR A GIVEN GROUP
- int groupID = 69;
- HttpResponseMessage responseGetUnique = client.Suppressions.Get(groupID).Result;
- Console.WriteLine(responseGetUnique.StatusCode);
- Console.WriteLine(responseGetUnique.Content.ReadAsStringAsync().Result);
- Console.WriteLine("These are the suppressed emails with group ID: " + groupID.ToString() + ". Press any key to continue.");
- Console.ReadKey();
-
- // ADD EMAILS TO A SUPPRESSION GROUP
- string[] emails = { "example@example.com", "example2@example.com" };
- HttpResponseMessage responsePost = client.Suppressions.Post(groupID, emails).Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails added to Suppression Group:" + groupID.ToString() + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE EMAILS FROM A SUPPRESSION GROUP
- Console.WriteLine("Deleting emails from Suppression Group, please wait.");
- HttpResponseMessage responseDelete1 = client.Suppressions.Delete(groupID, "example@example.com").Result;
- Console.WriteLine(responseDelete1.StatusCode);
- HttpResponseMessage responseDelete2 = client.Suppressions.Delete(groupID, "example2@example.com").Result;
- Console.WriteLine(responseDelete2.StatusCode);
- HttpResponseMessage responseFinal = client.Suppressions.Get(groupID).Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails removed from Suppression Group" + groupID.ToString() + "Deleted.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void GlobalSuppressions()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // CHECK IF EMAIL IS ON THE GLOBAL SUPPRESSION LIST
- var email = "elmer.thomas+test_global@gmail.com";
- HttpResponseMessage responseGetUnique = client.GlobalSuppressions.Get(email).Result;
- Console.WriteLine(responseGetUnique.StatusCode);
- Console.WriteLine(responseGetUnique.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Determines if the given email is listed on the Global Suppressions list. Press any key to continue.");
- Console.ReadKey();
-
- // ADD EMAILS TO THE GLOBAL SUPPRESSION LIST
- string[] emails = { "example@example.com", "example2@example.com" };
- HttpResponseMessage responsePost = client.GlobalSuppressions.Post(emails).Result;
- var rawString = responsePost.Content.ReadAsStringAsync().Result;
- dynamic jsonObject = JObject.Parse(rawString);
- Console.WriteLine(responsePost.StatusCode);
- Console.WriteLine(responsePost.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails added to Global Suppression Group.\n\nPress any key to continue.");
- Console.ReadKey();
-
- // DELETE EMAILS FROM THE GLOBAL SUPPRESSION GROUP
- Console.WriteLine("Deleting emails from Global Suppression Group, please wait.");
- HttpResponseMessage responseDelete1 = client.GlobalSuppressions.Delete("example@example.com").Result;
- Console.WriteLine(responseDelete1.StatusCode);
- HttpResponseMessage responseDelete2 = client.GlobalSuppressions.Delete("example2@example.com").Result;
- Console.WriteLine(responseDelete2.StatusCode);
- HttpResponseMessage responseFinal = client.GlobalSuppressions.Get("example@example.com").Result;
- Console.WriteLine(responseFinal.StatusCode);
- Console.WriteLine(responseFinal.Content.ReadAsStringAsync().Result);
- HttpResponseMessage responseFinal2 = client.GlobalSuppressions.Get("example2@example.com").Result;
- Console.WriteLine(responseFinal2.StatusCode);
- Console.WriteLine(responseFinal2.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Emails removed from Global Suppression Group.\n\nPress any key to end.");
- Console.ReadKey();
- }
-
- private static void GlobalStats()
- {
- String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
- var client = new SendGrid.Client(apiKey);
-
- // Global Stats provide all of your user’s email statistics for a given date range.
- var startDate = "2015-11-01";
- HttpResponseMessage response = client.GlobalStats.Get(startDate).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and no end date.\n\nPress any key to continue.");
- Console.ReadKey();
-
- var endDate = "2015-12-01";
- response = client.GlobalStats.Get(startDate, endDate).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- var aggregatedBy = "day";
- response = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + " and aggregated by " + aggregatedBy + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- aggregatedBy = "week";
- response = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + " and aggregated by " + aggregatedBy + ".\n\nPress any key to continue.");
- Console.ReadKey();
-
- aggregatedBy = "month";
- response = client.GlobalStats.Get(startDate, endDate, aggregatedBy).Result;
- Console.WriteLine(response.StatusCode);
- Console.WriteLine(response.Content.ReadAsStringAsync().Result);
- Console.WriteLine("Display global email stats, with start date " + startDate + "and end date " + endDate + " and aggregated by " + aggregatedBy + ".\n\nPress any key to continue.");
- Console.ReadKey();
- }
-
- }
-}
diff --git a/SendGrid/Example/WEBAPI.cs b/SendGrid/Example/WEBAPI.cs
deleted file mode 100644
index 1238df0..0000000
--- a/SendGrid/Example/WEBAPI.cs
+++ /dev/null
@@ -1,544 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Net.Mail;
-using SendGrid;
-
-namespace Example
-{
- internal class Webapi
- {
- private readonly String _from;
- private readonly String _password;
- private readonly IEnumerable<String> _to;
- private readonly String _username;
-
- public Webapi(String username, String password, String from, IEnumerable<String> recipients)
- {
- _username = username;
- _password = password;
- _from = from;
- _to = recipients;
- }
-
- /// <summary>
- /// Send a simple HTML based email
- /// </summary>
- public void SimpleHTMLEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "<html><p>Hello</p><p>World</p></html>";
-
- //set the message subject
- message.Subject = "Hello World HTML Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Send a simple Plain Text email
- /// </summary>
- public void SimplePlaintextEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hello World Plain Text";
-
- //set the message subject
- message.Subject = "Hello World Plain Text Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Enable The Gravatar Filter.
- /// Currently the filter generates a 1x1 pixel gravatar image.
- /// http://docs.sendgrid.com/documentation/apps/gravatar/
- /// </summary>
- public void EnableGravatarEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "<p style='color:red';>Hello World Gravatar Email</p>";
-
- //set the message subject
- message.Subject = "Hello World Gravatar Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable gravatar
- message.EnableGravatar();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Enable the Open Tracking to track when emails are opened.
- /// http://docs.sendgrid.com/documentation/apps/open-tracking/
- /// </summary>
- public void EnableOpenTrackingEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "<p style='color:red';>Hello World Plain Text</p>";
-
- //set the message subject
- message.Subject = "Hello World Open Tracking Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable gravatar
- message.EnableOpenTracking();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Point the urls to Sendgrid Servers so that the clicks can be logged before
- /// being directed to the appropriate link
- /// http://docs.sendgrid.com/documentation/apps/click-tracking/
- /// </summary>
- public void EnableClickTrackingEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World HTML </p> <a href='http://microsoft.com'>Checkout Microsoft!!</a>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "hello world http://microsoft.com";
-
- //set the message subject
- message.Subject = "Hello World Click Tracking Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable clicktracking
- message.EnableClickTracking();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// The Spam Checker filter, is useful when your web application allows your end users
- /// to create content that is then emailed through your SendGridMessage account.
- /// http://docs.sendgrid.com/documentation/apps/spam-checker-filter/
- /// </summary>
- public void EnableSpamCheckEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>VIAGRA!!!!!! Viagra!!! CHECKOUT THIS VIAGRA!!!! MALE ENHANCEMENT!!! </p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- //set the message subject
- message.Subject = "WIN A MILLION DOLLARS TODAY! WORK FROM HOME! A NIGERIAN PRINCE WANTS YOU!";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable spamcheck
- message.EnableSpamCheck();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// Add automatic unsubscribe links to the bottom of emails.
- /// http://docs.sendgrid.com/documentation/apps/subscription-tracking/
- /// </summary>
- public void EnableUnsubscribeEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Html = "This is the HTML body";
-
- message.Text = "This is the plain text body";
-
- //set the message subject
- message.Subject = "Hello World Unsubscribe Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable spamcheck
- //or optionally, you can specify 'replace' instead of the text and html in order to
- //place the link wherever you want.
- message.EnableUnsubscribe("Please click the following link to unsubscribe: <% %>",
- "Please click <% here %> to unsubscribe");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// The Footer App will insert a custom footer at the bottom of the text and HTML bodies.
- /// http://docs.sendgrid.com/documentation/apps/footer/
- /// </summary>
- public void EnableFooterEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Footer Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //Enable Footer
- message.EnableFooter("PLAIN TEXT FOOTER", "<p color='blue'>HTML FOOTER TEXT</p>");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// The Footer App will insert a custom footer at the bottom of the text and HTML bodies.
- /// http://docs.sendgrid.com/documentation/apps/google-analytics/
- /// </summary>
- public void EnableGoogleAnalytics()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
- message.Html += "Checkout my page at <a href=\"http://microsoft.com\">Microsoft</a>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Footer Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable Google Analytics
- message.EnableGoogleAnalytics("SendGridTest", "EMAIL", "Sendgrid", "ad-one", "My SG Campaign");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature wraps an HTML template around your email content.
- /// This can be useful for sending out newsletters and/or other HTML formatted messages.
- /// http://docs.sendgrid.com/documentation/apps/email-templates/
- /// </summary>
- public void EnableTemplateEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Template Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable template
- message.EnableTemplate("<p>My Email Template <% body %> is awesome!</p>");
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature wraps an HTML template around your email content.
- /// This can be useful for sending out newsletters and/or other HTML formatted messages.
- /// hhttp://docs.sendgrid.com/documentation/apps/email-templates/
- /// </summary>
- public void EnableBypassListManagementEmail()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- var timestamp = DateTime.Now.ToString("HH:mm:ss tt");
- message.Html = "<p style='color:red';>Hello World</p>";
- message.Html += "<p>Sent At : " + timestamp + "</p>";
-
- message.Text = "Hello World plain text";
-
- //set the message subject
- message.Subject = "Hello World Bypass List Management Test";
-
- //create an instance of the Web transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
-
- /// <summary>
- /// This feature allows you to create a message template, and specify different replacement
- /// strings for each specific recipient
- /// </summary>
- public void AddSubstitutionValues()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hi %name%! Pleased to meet you!";
-
- //set the message subject
- message.Subject = "Testing Substitution Values";
-
- //This replacement key must exist in the message body
- var replacementKey = "%name%";
-
- //There should be one value for each recipient in the To list
- var substitutionValues = new List<String> {"Mr Foo", "Mrs Raz"};
-
- message.AddSubstitution(replacementKey, substitutionValues);
-
- //create an instance of the SMTP transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature adds key value identifiers to be sent back as arguments over the event api for
- /// various events
- /// </summary>
- public void AddUniqueIdentifiers()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hello World";
-
- //set the message subject
- message.Subject = "Testing Unique Identifiers";
-
- var identifiers = new Dictionary<String, String>();
- identifiers["customer"] = "someone";
- identifiers["location"] = "somewhere";
-
- message.AddUniqueArgs(identifiers);
-
- //create an instance of the SMTP transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
-
- /// <summary>
- /// This feature tags the message with a specific tracking category, which will have aggregated stats
- /// viewable from your SendGridMessage account page.
- /// </summary>
- public void SetCategory()
- {
- //create a new message object
- var message = new SendGridMessage();
-
- //set the message recipients
- foreach (var recipient in _to)
- {
- message.AddTo(recipient);
- }
-
- //set the sender
- message.From = new MailAddress(_from);
-
- //set the message body
- message.Text = "Hello World";
-
- //set the message subject
- message.Subject = "Testing Categories";
-
- var category = "vipCustomers";
-
- message.SetCategory(category);
-
- //create an instance of the SMTP transport mechanism
- var transportInstance = new Web(new NetworkCredential(_username, _password));
-
- //enable bypass list management
- message.EnableBypassListManagement();
-
- //send the mail
- transportInstance.DeliverAsync(message);
- }
- }
-} \ No newline at end of file
diff --git a/SendGrid/Example/app.config b/SendGrid/Example/app.config
index ea6ea7f..5cbb8d5 100644
--- a/SendGrid/Example/app.config
+++ b/SendGrid/Example/app.config
@@ -1,25 +1,25 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
- <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0"/>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0"/>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
- <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0"/>
+ <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0" />
</dependentAssembly>
<dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
- <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
diff --git a/SendGrid/Example/packages.config b/SendGrid/Example/packages.config
index 8aa9f7b..a5881ad 100644
--- a/SendGrid/Example/packages.config
+++ b/SendGrid/Example/packages.config
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
+ <package id="SendGrid.CSharp.HTTP.Client" version="1.0.2" targetFramework="net45" />
<package id="SendGrid.SmtpApi" version="1.3.1" targetFramework="net45" />
</packages> \ No newline at end of file