diff options
author | CJ Buchmann <cj.buchmann@sendgrid.com> | 2012-01-13 16:42:38 -0800 |
---|---|---|
committer | CJ Buchmann <cj.buchmann@sendgrid.com> | 2012-01-13 16:42:38 -0800 |
commit | cc7e8b7a0aae5381899ea1ea4c91e467f170348a (patch) | |
tree | d0062795c0cf8dc2f1abf2d0d8dc226a96809be7 /SendGrid/Example/Program.cs | |
parent | 2cc3f7ecf61374d9b88d41290fe29c04a3849d6c (diff) | |
parent | ba5a61b85f19027b240588216a6fc3d418214e04 (diff) | |
download | sendgrid-csharp-cc7e8b7a0aae5381899ea1ea4c91e467f170348a.zip sendgrid-csharp-cc7e8b7a0aae5381899ea1ea4c91e467f170348a.tar.gz sendgrid-csharp-cc7e8b7a0aae5381899ea1ea4c91e467f170348a.tar.bz2 |
Merge branch 'us1882' of github.com:sendgrid/sendgrid-csharp
Diffstat (limited to 'SendGrid/Example/Program.cs')
-rwxr-xr-x | SendGrid/Example/Program.cs | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs index abf67f0..87c44a4 100755 --- a/SendGrid/Example/Program.cs +++ b/SendGrid/Example/Program.cs @@ -1,16 +1,79 @@ using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net;
using System.Net.Mail;
using System.Text;
+using SendGridMail;
+using SendGridMail.Transport;
namespace Example
{
class Program
{
- static void Main(string[] args)
+ static void Main(String[] args)
{
+ var restInstance = REST.GetInstance(new NetworkCredential("sgrid_username", "sgrid_password"));
+ //create a new message object
+ var message = SendGrid.GenerateInstance();
+
+ message.AddTo("cj.buchmann@sendgrid.com");
+ message.AddTo("tyler.bischel@sendgrid.com");
+ message.AddTo("kyle.partridge@sendgrid.com");
+ message.From = new MailAddress("cj.buchmann@sendgrid.com");
+ message.Html = "<div>hello world</div>";
+ message.Subject = "Hello World SUbject";
+ message.AddAttachment(@"C:\Users\Public\Pictures\Sample Pictures\Koala.jpg");
+ message.AddAttachment(@"C:\Users\Public\Pictures\Sample Pictures\Jellyfish.jpg");
+
+ restInstance.Deliver(message);
+
+ Console.WriteLine("Message Sent");
+ Console.WriteLine("DONE!");
+ Console.ReadLine();
}
+
+ // this code is used for the SMTPAPI examples
+ /*static void Main(string[] args)
+ {
+ var username = "cjbuchmann";
+ var password = "gadget15";
+ var from = "cj.buchmann@sendgrid.com";
+ var to = new List<String>
+ {
+ "cj.buchmann@sendgrid.com"
+ };
+
+ var bcc = new List<string>
+ {
+ "eric@sendgrid.com"
+ };
+
+ var cc = new List<string>
+ {
+ "eric@sendgrid.com"
+ };
+
+ //initialize the SMTPAPI example class
+ var smtpapi = new SMTPAPI(username, password, from, to);
+
+ //send a simple HTML encoded email.
+ //smtpapi.SimpleHTMLEmail();
+
+ //send a simple Plaintext email.
+ //smtpapi.SimplePlaintextEmail();
+
+ //send a gravatar enabled email.
+ //smtpapi.EnableGravatarEmail();
+
+ //send an open tracking enabled email.
+ //smtpapi.EnableOpenTrackingEmail();
+
+ //send an open tracking enabled email.
+ smtpapi.EnableClickTrackingEmail();
+
+ Console.ReadLine();
+ }*/
}
}
|