Skip to content

Commit 71b2b38

Browse files
Update README with API Key instructions
1 parent 5b355fb commit 71b2b38

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

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

0 commit comments

Comments
 (0)