Skip to content

Commit e75eaee

Browse files
committed
Update README.md
1 parent 8a6f36c commit e75eaee

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,17 @@ myMessage.Text = "Hello World plain text!";
5959

6060
After creating an email message, you can send it using the Web API provided by SendGrid.
6161

62-
Sending email requires that you supply your SendGrid account credentials (username and password). The following code demonstrates how to wrap your credentials in a **NetworkCredential** object:
62+
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
6465
```csharp
6566
// Create network credentials to access your SendGrid account.
6667
var username = "your_sendgrid_username";
6768
var pswd = "your_sendgrid_password";
6869

6970
var credentials = new NetworkCredential(username, pswd);
7071
```
71-
To send an email message, use the **Deliver** method on the **Web** transport class, which calls the SendGrid Web API. The following example shows how to send a message.
72+
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.
7273

7374

7475
```csharp
@@ -82,8 +83,11 @@ myMessage.Text = "Hello World!";
8283
// Create credentials, specifying your user name and password.
8384
var credentials = new NetworkCredential("username", "password");
8485

85-
// Create an Web transport for sending email.
86-
var transportWeb = new Web(credentials);
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");
8791

8892
// Send the email.
8993
transportWeb.DeliverAsync(myMessage);

0 commit comments

Comments
 (0)