Skip to content

Commit 6d5b3a4

Browse files
Merge pull request #164 from sendgrid/apikeys-2
Implement pull #127, add api key constructors
2 parents d685ac8 + 1c1806d commit 6d5b3a4

File tree

7 files changed

+255
-238
lines changed

7 files changed

+255
-238
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
# Change Log
1+
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [6.3.0] - 2015-11-24
5+
###Added
6+
- Send emails using API Key
7+
48
## [6.2.0] - 2015-11-18
59
###Added
6-
- Added support for using the Web API v3 endpoints.
10+
- Added support for using the Web API v3 endpoints
711
- Implemented the api_keys endpoint [GET, POST, PATCH, DELETE]
812

913
## [6.1.0] - 2015-4-27
1014
###Added
11-
- Added support for sending via API keys in addition to credentials. Pass an API Key string to the Web transport constructor.
15+
- Added support for sending via API keys in addition to credentials. Pass an API Key string to the Web transport constructor
1216

1317
## [6.0.1] - 2015-4-24
1418
###Fixed

README.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,8 @@ After creating an email message, you can send it using the Web API provided by S
6161

6262
Sending email requires that you supply your SendGrid account credentials (username and password) OR a SendGrid API Key. API Key is the preferred method. API Keys are in beta. To configure API keys, visit https://sendgrid.com/beta/settings/api_keys
6363

64-
Using Credentials
65-
```csharp
66-
// Create network credentials to access your SendGrid account.
67-
var username = "your_sendgrid_username";
68-
var pswd = "your_sendgrid_password";
69-
70-
var credentials = new NetworkCredential(username, pswd);
71-
```
7264
To send an email message, use the **DeliverAsync** method on the **Web** transport class, which calls the SendGrid Web API. The following example shows how to send a message.
7365

74-
7566
```csharp
7667
// Create the email object first, then add the properties.
7768
SendGridMessage myMessage = new SendGridMessage();
@@ -80,18 +71,12 @@ myMessage.From = new MailAddress("[email protected]", "John Smith");
8071
myMessage.Subject = "Testing the SendGrid Library";
8172
myMessage.Text = "Hello World!";
8273

83-
// Create credentials, specifying your user name and password.
84-
var credentials = new NetworkCredential("username", "password");
85-
86-
// Create an Web transport for sending email, using credentials...
87-
//var transportWeb = new Web(credentials);
88-
89-
// ...OR create a Web transport, using API Key (preferred)
90-
var transportWeb = new Web("This string is an API key");
74+
// Create a Web transport, using API Key
75+
var transportWeb = new Web("This string is a SendGrid API key");
9176

9277
// Send the email.
9378
transportWeb.DeliverAsync(myMessage);
94-
// If your developing a Console Application, use the following
79+
// NOTE: If your developing a Console Application, use the following so that the API call has time to complete
9580
// transportWeb.DeliverAsync(myMessage).Wait();
9681
```
9782

SendGrid/Example/Program.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,9 @@ private static void Main()
2222

2323
private static void SendAsync(SendGrid.SendGridMessage message)
2424
{
25-
// Create credentials, specifying your user Name and password.
26-
var username = Environment.GetEnvironmentVariable("SENDGRID_USERNAME");
27-
var password = Environment.GetEnvironmentVariable("SENDGRID_PASSWORD");
28-
//string apikey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
29-
var credentials = new NetworkCredential(username, password);
30-
25+
string apikey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
3126
// Create a Web transport for sending email.
32-
var transportWeb = new SendGrid.Web(credentials);
33-
//var transportWeb2 = new SendGrid.Web(apikey);
27+
var transportWeb = new SendGrid.Web(apikey);
3428

3529
// Send the email.
3630
try

SendGrid/SendGrid/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// set of attributes. Change these attribute values to modify the information
77
// associated with an assembly.
88
[assembly: AssemblyTitle("SendGrid")]
9-
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyDescription("A client library for SendGrid Web API v3 endpoints")]
1010
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyCompany("SendGrid")]
1212
[assembly: AssemblyProduct("SendGrid")]
1313
[assembly: AssemblyCopyright("Copyright © 2015")]
1414
[assembly: AssemblyTrademark("")]
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("6.3.0")]
36+
[assembly: AssemblyFileVersion("6.3.0")]

SendGrid/SendGridMail/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@
5858
// by using the '*' as shown below:
5959
// [assembly: AssemblyVersion("1.0.*")]
6060

61-
[assembly: AssemblyVersion("6.0.0")]
62-
[assembly: AssemblyFileVersion("6.0.0")]
61+
[assembly: AssemblyVersion("6.3.0")]
62+
[assembly: AssemblyFileVersion("6.3.0")]

0 commit comments

Comments
 (0)