summaryrefslogtreecommitdiffstats
path: root/SendGrid/Example
diff options
context:
space:
mode:
authorElmer Thomas <elmer@thinkingserious.com>2016-06-14 10:22:39 -0700
committerElmer Thomas <elmer@thinkingserious.com>2016-06-14 10:22:39 -0700
commit1e2111f09142552d7dde4e18f116835dec91ed86 (patch)
tree1de111c549454450ce5a45aa129726132db217b5 /SendGrid/Example
parent5ee89f857c09d79e507483bd807727bb6c4d7057 (diff)
parent2e52cfb07decb924a961b5c75ece1b9e79ab973c (diff)
downloadsendgrid-csharp-7.0.1.zip
sendgrid-csharp-7.0.1.tar.gz
sendgrid-csharp-7.0.1.tar.bz2
Merge branch 'v3release'v7.0.1v7.0.0
Diffstat (limited to 'SendGrid/Example')
-rw-r--r--SendGrid/Example/Example.cs329
-rw-r--r--SendGrid/Example/Example.csproj21
-rw-r--r--SendGrid/Example/Program.cs263
-rw-r--r--SendGrid/Example/Properties/AssemblyInfo.cs14
-rw-r--r--SendGrid/Example/WEBAPI.cs544
-rw-r--r--SendGrid/Example/app.config20
-rw-r--r--SendGrid/Example/packages.config3
7 files changed, 358 insertions, 836 deletions
diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs
new file mode 100644
index 0000000..5155e9d
--- /dev/null
+++ b/SendGrid/Example/Example.cs
@@ -0,0 +1,329 @@
+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(); // this will actually send an email
+ KitchenSink(); // this will only send an email if you set SandBox Mode to false
+
+ // v3 Web API
+ ApiKeys();
+
+ }
+
+ private static void HelloEmail()
+ {
+ String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
+ dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
+
+ Email from = new Email("test@example.com");
+ String subject = "Hello World from the SendGrid CSharp Library";
+ Email to = new Email("test@example.com");
+ Content content = new Content("text/plain", "Textual content");
+ Mail mail = new Mail(from, subject, to, content);
+ Email email = new Email("test2@example.com");
+ mail.Personalization[0].AddTo(email);
+
+ String ret = mail.Get();
+
+ string requestBody = ret;
+ dynamic response = sg.client.mail.send.beta.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.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://api.sendgrid.com");
+
+ Mail mail = new Mail();
+
+ Email email = new Email();
+ email.Name = "Example User";
+ email.Address = "test@example.com";
+ mail.From = email;
+
+ mail.Subject = "Hello World from the SendGrid CSharp Library";
+
+ Personalization personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test1@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test2@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test3@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test4@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test5@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ personalization.AddCustomArgs("marketing", "false");
+ personalization.AddCustomArgs("transactional", "true");
+ personalization.SendAt = 1461775051;
+ mail.AddPersonalization(personalization);
+
+ personalization = new Personalization();
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test1@example.com";
+ personalization.AddTo(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test2@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test3@example.com";
+ personalization.AddCc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test4@example.com";
+ personalization.AddBcc(email);
+ email = new Email();
+ email.Name = "Example User";
+ email.Address = "test5@example.com";
+ personalization.AddBcc(email);
+ personalization.Subject = "Thank you for signing up, %name%";
+ personalization.AddHeader("X-Test", "True");
+ personalization.AddHeader("X-Mock", "True");
+ personalization.AddSubstitution("%name%", "Example User");
+ personalization.AddSubstitution("%city%", "Denver");
+ 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 = "BwdW";
+ 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";
+
+ // This must be a valid [batch ID](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html)
+ // mail.BatchId = "some_batch_id";
+
+ MailSettings mailSettings = new MailSettings();
+ BCCSettings bccSettings = new BCCSettings();
+ bccSettings.Enable = true;
+ bccSettings.Email = "test@example.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 = true;
+ 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 = true;
+ 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 = "test@example.com";
+ mail.ReplyTo = email;
+
+ String ret = mail.Get();
+
+ string requestBody = ret;
+ dynamic response = sg.client.mail.send.beta.post(requestBody: requestBody);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.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://api.sendgrid.com");
+
+ string queryParams = @"{
+ 'limit': 100
+ }";
+ dynamic response = sg.client.api_keys.get(queryParams: queryParams);
+ Console.WriteLine(response.StatusCode);
+ Console.WriteLine(response.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.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.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.ToString());
+ JavaScriptSerializer jss = new JavaScriptSerializer();
+ var ds_response = jss.Deserialize<Dictionary<string, dynamic>>(response.Body.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.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.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.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.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.Body.ReadAsStringAsync().Result);
+ Console.WriteLine(response.Headers.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.Headers.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..98044fa 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>
@@ -46,8 +46,12 @@
</PropertyGroup>
<ItemGroup>
<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.CSharp.HTTP.Client, Version=2.0.0.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
+ <HintPath>..\packages\SendGrid.CSharp.HTTP.Client.2.0.1\lib\SendGrid.CSharp.HTTP.Client.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>
@@ -87,7 +86,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
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/Properties/AssemblyInfo.cs b/SendGrid/Example/Properties/AssemblyInfo.cs
index 87d5e71..8c0cc2a 100644
--- a/SendGrid/Example/Properties/AssemblyInfo.cs
+++ b/SendGrid/Example/Properties/AssemblyInfo.cs
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -27,13 +27,13 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0")]
-[assembly: AssemblyFileVersion("1.2.0")] \ No newline at end of file
+[assembly: AssemblyVersion("7.0.0")]
+[assembly: AssemblyFileVersion("7.0.0")] \ No newline at end of file
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..8382638 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" />
</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..a0de518 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="2.0.1" targetFramework="net452" />
<package id="SendGrid.SmtpApi" version="1.3.1" targetFramework="net45" />
</packages> \ No newline at end of file