diff options
author | Neeraj <neeraj.viman@gmail.com> | 2014-05-22 11:37:28 +0530 |
---|---|---|
committer | Neeraj <neeraj.viman@gmail.com> | 2014-05-22 11:37:28 +0530 |
commit | 93207b2b8a7223ed2d9bc698839c05950efd020a (patch) | |
tree | f2e008ee6e3e5ff328fa6a779abf2be6a2e91cc0 | |
parent | c397b905d338b528e0534a2235d7b2f757f16b4d (diff) | |
download | sendgrid-csharp-93207b2b8a7223ed2d9bc698839c05950efd020a.zip sendgrid-csharp-93207b2b8a7223ed2d9bc698839c05950efd020a.tar.gz sendgrid-csharp-93207b2b8a7223ed2d9bc698839c05950efd020a.tar.bz2 |
Update Readme.md for 3.0.0 version
Fixed the examples as per the new changes in 3.0.0
-rwxr-xr-x | README.md | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1,6 +1,9 @@ ##Breaking API changes in 3.0.0! -Use `new SendGridMessage()` instead of `SendGrid.GetInstance()` +Use +`new SendGridMessage()` instead of `SendGrid.GetInstance()` + +and `new Web()` instead of `Web.GetInstance()` #Requirements @@ -73,7 +76,7 @@ To send an email message, use the **Deliver** method on the **Web** transport cl ```csharp // Create the email object first, then add the properties. -SendGrid myMessage = new SendGridMessage(); +SendGridMessage myMessage = new SendGridMessage(); myMessage.AddTo("anna@example.com"); myMessage.From = new MailAddress("john@example.com", "John Smith"); myMessage.Subject = "Testing the SendGrid Library"; @@ -83,7 +86,7 @@ myMessage.Text = "Hello World!"; var credentials = new NetworkCredential("username", "password"); // Create an Web transport for sending email. -var transportWeb = Web.GetInstance(credentials); +var transportWeb = new Web(credentials); // Send the email. transportWeb.Deliver(myMessage); @@ -97,7 +100,7 @@ task. Attachments can be added to a message by calling the **AddAttachment** method and specifying the name and path of the file you want to attach, or by passing a stream. You can include multiple attachments by calling this method once for each file you wish to attach. The following example demonstrates adding an attachment to a message: ```csharp -SendGrid myMessage = New SendGridMessage(); +SendGridMessage myMessage = New SendGridMessage(); myMessage.AddTo("anna@example.com"); myMessage.From = new MailAddress("john@example.com", "John Smith"); myMessage.Subject = "Testing the SendGrid Library"; @@ -109,7 +112,7 @@ myMessage.AddAttachment(@"C:\file1.txt"); You can also add attachments from the data's **Stream**. It can be done by calling the same method as above, **AddAttachment**, but by passing in the Stream of the data, and the filename you want it to show as in the message. ```csharp -SendGrid myMessage = New SendGridMessage(); +SendGridMessage myMessage = New SendGridMessage(); myMessage.AddTo("anna@example.com"); myMessage.From = new MailAddress("john@example.com", "John Smith"); myMessage.Subject = "Testing the SendGrid Library"; @@ -132,7 +135,7 @@ The following examples demonstrate the footer and click tracking filters: ##Footer ```csharp // Create the email object first, then add the properties. -SendGrid myMessage = New SendGridMessage(); +SendGridMessage myMessage = New SendGridMessage(); myMessage.AddTo("anna@example.com"); myMessage.From = new MailAddress("john@example.com", "John Smith"); myMessage.Subject = "Testing the SendGrid Library"; @@ -145,7 +148,7 @@ myMessage.EnableFooter("PLAIN TEXT FOOTER", "<p><em>HTML FOOTER</em></p>"); ##Click tracking ```csharp // Create the email object first, then add the properties. -SendGrid myMessage = New SendGridMessage(); +SendGridMessage myMessage = New SendGridMessage(); myMessage.AddTo("anna@example.com"); myMessage.From = new MailAddress("john@example.com", "John Smith"); myMessage.Subject = "Testing the SendGrid Library"; |