diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-05-10 14:57:30 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-05-10 14:57:30 -0700 |
commit | e6caebf2dc8842d3c64f0fbd74efcab211a279c7 (patch) | |
tree | 6e7ebab7a3a586a8612f92e5b40fd1b869c2c506 | |
parent | 78a455345607ca9ff547ef7bf21109df5be5bcb6 (diff) | |
download | sendgrid-csharp-e6caebf2dc8842d3c64f0fbd74efcab211a279c7.zip sendgrid-csharp-e6caebf2dc8842d3c64f0fbd74efcab211a279c7.tar.gz sendgrid-csharp-e6caebf2dc8842d3c64f0fbd74efcab211a279c7.tar.bz2 |
Ready to deploy
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | SendGrid/Example/Example.cs | 9 | ||||
-rw-r--r-- | SendGrid/SendGrid/Helpers/Mail/Mail.cs | 2 | ||||
-rw-r--r-- | SendGrid/SendGrid/Helpers/Mail/README.md | 6 | ||||
-rw-r--r-- | SendGrid/UnitTest/UnitTest.cs | 11 |
5 files changed, 22 insertions, 20 deletions
@@ -1,4 +1,4 @@ -[](https://travis-ci.org/sendgrid/sendgrid-csharp) +[](https://travis-ci.org/sendgrid/sendgrid-csharp) **This library allows you to quickly and easily use the SendGrid Web API via C Sharp with .NET.** @@ -113,16 +113,16 @@ Thank you for your continued support! We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/sendgrid-csharp/blob/master/CONTRIBUTING.md) guide for details. -* [Feature Request](https://github.com/sendgrid/sendgrid-csharp/blob/master/CONTRIBUTING.md#feature_request) -* [Bug Reports](https://github.com/sendgrid/sendgrid-csharp/blob/master/CONTRIBUTING.md#submit_a_bug_report) -* [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-csharp/blob/master/CONTRIBUTING.md#improvements_to_the_codebase) +* [Feature Request](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md#feature_request) +* [Bug Reports](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md#submit_a_bug_report) +* [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/CONTRIBUTING.md#improvements_to_the_codebase) ## Usage - [SendGrid Docs](https://sendgrid.com/docs/API_Reference/index.html) -- [v3 Web API](https://github.com/sendgrid/sendgrid-csharp/blob/master/USAGE.md) -- [Example Code](https://github.com/sendgrid/sendgrid-csharp/blob/master/examples) -- [v3 Web API Mail Send Helper]() +- [v3 Web API](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/USAGE.md) +- [Example Code](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/examples) +- [v3 Web API Mail Send Helper](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/SendGrid/SendGrid/Helpers/Mail) ## Unsupported Libraries diff --git a/SendGrid/Example/Example.cs b/SendGrid/Example/Example.cs index f48780f..30ccea4 100644 --- a/SendGrid/Example/Example.cs +++ b/SendGrid/Example/Example.cs @@ -21,7 +21,7 @@ namespace Example private static void HelloEmail() { String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://3wyb2hp7emnqja6ys.stoplight-proxy.io"); + dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com"); Email from = new Email("dx@sendgrid.com"); String subject = "Hello World from the SendGrid CSharp Library"; @@ -47,7 +47,7 @@ namespace Example private static void KitchenSink() { String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://3wyb2hp7emnqja6ys.stoplight-proxy.io"); + dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com"); Mail mail = new Mail(); @@ -176,7 +176,8 @@ namespace Example mail.SetIpPoolId = "23"; - mail.BatchId = "some_batch_id"; + // 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(); @@ -245,7 +246,7 @@ namespace Example private static void ApiKeys() { String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); - dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://e9sk3d3bfaikbpdq7.stoplight-proxy.io"); + dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com"); string queryParams = @"{ 'limit': 100 diff --git a/SendGrid/SendGrid/Helpers/Mail/Mail.cs b/SendGrid/SendGrid/Helpers/Mail/Mail.cs index 98f918d..52dbb9a 100644 --- a/SendGrid/SendGrid/Helpers/Mail/Mail.cs +++ b/SendGrid/SendGrid/Helpers/Mail/Mail.cs @@ -70,7 +70,7 @@ namespace SendGrid.Helpers.Mail } } - [JsonProperty(PropertyName = "personalization")] + [JsonProperty(PropertyName = "personalizations")] public List<Personalization> Personalization { get diff --git a/SendGrid/SendGrid/Helpers/Mail/README.md b/SendGrid/SendGrid/Helpers/Mail/README.md index 15f697c..313f363 100644 --- a/SendGrid/SendGrid/Helpers/Mail/README.md +++ b/SendGrid/SendGrid/Helpers/Mail/README.md @@ -2,11 +2,11 @@ # Quick Start -Run the [example]() (make sure you have set your environment variable to include your SENDGRID_API_KEY). +Run the [example](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/examples) (make sure you have set your environment variable to include your SENDGRID_API_KEY). Click on the Example project, then click the `Start` button in the menu. ## Usage -- See the example for a complete working example. -- [Documentation]()
\ No newline at end of file +- See the [example](https://github.com/sendgrid/sendgrid-csharp/tree/v3beta/examples) for a complete working example. +- [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/overview.html)
\ No newline at end of file diff --git a/SendGrid/UnitTest/UnitTest.cs b/SendGrid/UnitTest/UnitTest.cs index 2bf2b75..c8105be 100644 --- a/SendGrid/UnitTest/UnitTest.cs +++ b/SendGrid/UnitTest/UnitTest.cs @@ -58,7 +58,7 @@ namespace UnitTest mail.AddContent(content); String ret = mail.Get(); - Assert.AreEqual(ret, "{\"from\":{\"email\":\"dx@sendgrid.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalization\":[{\"to\":[{\"email\":\"elmer.thomas@sendgrid.com\"}]}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"}]}"); + Assert.AreEqual(ret, "{\"from\":{\"email\":\"dx@sendgrid.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"email\":\"elmer.thomas@sendgrid.com\"}]}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"}]}"); } // All paramaters available for sending an email @@ -192,7 +192,8 @@ namespace UnitTest mail.SetIpPoolId = "23"; - mail.BatchId = "some_batch_id"; + // 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(); @@ -208,7 +209,7 @@ namespace UnitTest footerSettings.Html = "<bold>Some HTML Here</bold>"; mailSettings.FooterSettings = footerSettings; SandboxMode sandboxMode = new SandboxMode(); - sandboxMode.Enable = false; + sandboxMode.Enable = true; mailSettings.SandboxMode = sandboxMode; SpamCheck spamCheck = new SpamCheck(); spamCheck.Enable = true; @@ -219,7 +220,7 @@ namespace UnitTest TrackingSettings trackingSettings = new TrackingSettings(); ClickTracking clickTracking = new ClickTracking(); - clickTracking.Enable = false; + clickTracking.Enable = true; clickTracking.EnableText = false; trackingSettings.ClickTracking = clickTracking; OpenTracking openTracking = new OpenTracking(); @@ -247,7 +248,7 @@ namespace UnitTest mail.ReplyTo = email; String ret = mail.Get(); - Assert.AreEqual(ret, "{\"from\":{\"name\":\"DX\",\"email\":\"dx@sendgrid.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalization\":[{\"to\":[{\"name\":\"Elmer Thomas\",\"email\":\"elmer.thomas@sendgrid.com\"}],\"cc\":[{\"name\":\"Matt Bernier\",\"email\":\"matt.bernier@sendgrid.com\"},{\"name\":\"Eric Shallock\",\"email\":\"eric.shallock@sendgrid.com\"}],\"bcc\":[{\"name\":\"Elmer Thomas Secret\",\"email\":\"elmer.thomas+secret@sendgrid.com\"},{\"name\":\"Elmer Thomas Secret 2\",\"email\":\"elmer.thomas+secret@gmail.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Elmer\",\"%city%\":\"Moreno Valley\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Elmer Thomas\",\"email\":\"elmer.thomas@gmail.com\"}],\"cc\":[{\"name\":\"Matt Bernier\",\"email\":\"matt.bernier@sendgrid.com\"},{\"name\":\"Eric Shallock\",\"email\":\"eric.shallock@sendgrid.com\"}],\"bcc\":[\"elmer.thomas+secret@sengrid.com\",\"elmer.thomas+secr],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Elmer\",\"%city%\":\"Moreno Valley\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"batch_id\":\"some_batch_id\",\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"dx@sendgrid.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_name\":\"some campaign\"}},\"reply_to\":{\"email\":\"dx@sendgrid.com\"}}"); + Assert.AreEqual(ret, "{\"from\":{\"name\":\"DX\",\"email\":\"dx@sendgrid.com\"},\"subject\":\"Hello World from the SendGrid CSharp Library\",\"personalizations\":[{\"to\":[{\"name\":\"Elmer Thomas\",\"email\":\"elmer.thomas@sendgrid.com\"}],\"cc\":[{\"name\":\"Matt Bernier\",\"email\":\"matt.bernier@sendgrid.com\"},{\"name\":\"Eric Shallock\",\"email\":\"eric.shallock@sendgrid.com\"}],\"bcc\":[{\"name\":\"Elmer Thomas Secret\",\"email\":\"elmer.thomas + secret@sengrid.com\"},{\"name\":\"Elmer Thomas Secret 2\",\"email\":\"elmer.thomas+secret@elmer.thomas.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Elmer\",\"%city%\":\"Moreno Valley\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051},{\"to\":[{\"name\":\"Elmer Thomas\",\"email\":\"elmer.thomas@gmail.com\"}],\"cc\":[{\"name\":\"Matt Bernier\",\"email\":\"matt.bernier@sendgrid.com\"},{\"name\":\"Eric Shallock\",\"email\":\"eric.shallock@sendgrid.com\"}],\"bcc\":[{\"name\":\"Elmer Thomas Secret\",\"email\":\"elmer.thomas + secret@sengrid.com\"},{\"name\":\"Elmer Thomas Secret 2\",\"email\":\"elmer.thomas+secret@elmer.thomas.com\"}],\"subject\":\"Thank you for signing up, %name%\",\"headers\":{\"X-Test\":\"True\",\"X-Mock\":\"True\"},\"substitutions\":{\"%name%\":\"Elmer\",\"%city%\":\"Moreno Valley\"},\"custom_args\":{\"marketing\":\"false\",\"transactional\":\"true\"},\"send_at\":1461775051}],\"content\":[{\"type\":\"text/plain\",\"value\":\"Textual content\"},{\"type\":\"text/html\",\"value\":\"<html><body>HTML content</body></html>\"},{\"type\":\"text/calendar\",\"value\":\"Party Time!!\"}],\"attachments\":[{\"content\":\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12\",\"type\":\"application/pdf\",\"filename\":\"balance_001.pdf\",\"disposition\":\"attachment\",\"content_id\":\"Balance Sheet\"},{\"content\":\"BwdW\",\"type\":\"image/png\",\"filename\":\"banner.png\",\"disposition\":\"inline\",\"content_id\":\"Banner\"}],\"template_id\":\"13b8f94f-bcae-4ec6-b752-70d6cb59f932\",\"headers\":{\"X-Day\":\"Monday\",\"X-Month\":\"January\"},\"sections\":{\"%section1\":\"Substitution for Section 1 Tag\",\"%section2\":\"Substitution for Section 2 Tag\"},\"categories\":[\"customer\",\"vip\"],\"custom_args\":{\"campaign\":\"welcome\",\"sequence\":\"2\"},\"send_at\":1461775051,\"asm\":{\"group_id\":3,\"groups_to_display\":[1,4,5]},\"ip_pool_name\":\"23\",\"mail_settings\":{\"bcc\":{\"enable\":true,\"email\":\"dx@sendgrid.com\"},\"bypass_list_management\":{\"enable\":true},\"footer\":{\"enable\":true,\"text\":\"Some Footer Text\",\"html\":\"<bold>Some HTML Here</bold>\"},\"sandbox_mode\":{\"enable\":true},\"spam_check\":{\"enable\":true,\"threshold\":1,\"post_to_url\":\"https://gotchya.example.com\"}},\"tracking_settings\":{\"click_tracking\":{\"enable\":true},\"open_tracking\":{\"enable\":true,\"substitution_tag\":\"Optional tag to replace with the open image in the body of the message\"},\"subscription_tracking\":{\"enable\":true,\"text\":\"text to insert into the text/plain portion of the message\",\"html\":\"<bold>HTML to insert into the text/html portion of the message</bold>\",\"substitution_tag\":\"text to insert into the text/plain portion of the message\"},\"ganalytics\":{\"enable\":true,\"utm_source\":\"some source\",\"utm_medium\":\"some medium\",\"utm_term\":\"some term\",\"utm_content\":\"some content\",\"utm_campaign\":\"some campaign\"}},\"reply_to\":{\"email\":\"dx@sendgrid.com\"}}"); } } } |