diff options
author | CJ Buchmann <cj.buchmann@sendgrid.com> | 2012-01-12 19:24:30 -0800 |
---|---|---|
committer | CJ Buchmann <cj.buchmann@sendgrid.com> | 2012-01-12 19:24:30 -0800 |
commit | 13ea4240f2e863704320ae7c0dc62a6f59d592f0 (patch) | |
tree | 93774191f19422b6e61e4c16916f3f0c4ea1a7ce /SendGrid/Example | |
parent | 48068853163d337f34cd1f971361d6caf97bd7a7 (diff) | |
download | sendgrid-csharp-13ea4240f2e863704320ae7c0dc62a6f59d592f0.zip sendgrid-csharp-13ea4240f2e863704320ae7c0dc62a6f59d592f0.tar.gz sendgrid-csharp-13ea4240f2e863704320ae7c0dc62a6f59d592f0.tar.bz2 |
Got All parts of the REST api working, except file attachments.
Diffstat (limited to 'SendGrid/Example')
-rwxr-xr-x | SendGrid/Example/Program.cs | 5 | ||||
-rwxr-xr-x | SendGrid/Example/RESTAPI.cs | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs index 4d16952..472d5b7 100755 --- a/SendGrid/Example/Program.cs +++ b/SendGrid/Example/Program.cs @@ -18,8 +18,7 @@ namespace Example var from = "cj.buchmann@sendgrid.com";
var to = new List<String>
{
- "cj.buchmann@sendgrid.com",
- "tyler.bischel@sendgrid.com"
+ "cj.buchmann@sendgrid.com"
};
var bcc = new List<string>
@@ -34,7 +33,7 @@ namespace Example //initialize the SMTPAPI example class
var smtpapi = new SMTPAPI(username, password, from, to);
- var restpapi = new RESTAPI(username, password, from, to, null, cc);
+ var restpapi = new RESTAPI(username, password, from, to, null, null);
//send a simple HTML encoded email.
//smtpapi.SimpleHTMLEmail();
diff --git a/SendGrid/Example/RESTAPI.cs b/SendGrid/Example/RESTAPI.cs index ca4e507..a80c536 100755 --- a/SendGrid/Example/RESTAPI.cs +++ b/SendGrid/Example/RESTAPI.cs @@ -1,4 +1,5 @@ using System;
+using System.Linq;
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;
@@ -57,7 +58,19 @@ namespace Example message.AddCc(cc);
}
}
-
+
+ var headers = new Dictionary<String, String>
+ {
+ {"key1", "value1"},
+ {"key2", "value2"},
+ {"icanhazcheeze", "kthnxbye"}
+ };
+
+ message.AddHeaders(headers);
+
+ //var replyTo = new List<MailAddress> { new MailAddress("tyler.bischel@sendgrid.com") };
+
+ //message.ReplyTo = replyTo.ToArray();
//set the sender
message.From = new MailAddress(_from);
@@ -68,6 +81,8 @@ namespace Example //set the message subject
message.Subject = "Hello World Simple Test";
+ //Utils.PrepareAttachments();
+
//create an instance of the SMTP transport mechanism
var restInstance = new REST(new NetworkCredential(_username, _password));
|