blob: 7beff35c69441f3a047d2b09a9b062ed5e84b054 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
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)
{
var restInstance = new REST(new NetworkCredential("cjbuchmann", "Gadget_15"));
//create a new message object
var message = new SendGrid(new Header());
message.AddTo("cj.buchmann@sendgrid.com");
message.From = new MailAddress("cj.buchmann@sendgrid.com");
message.Html = "<div>hello world</div>";
message.Subject = "Hello World SUbject";
message.AddAttachment(@"D:\att_proj\21.jpg");
restInstance.Deliver(message);
Console.WriteLine("Message Sent");
Console.WriteLine("DONE!");
}
/*static void Main(string[] args)
{
var username = "cjbuchmann";
var password = "Gadget_15";
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);
var restpapi = new RESTAPI(username, password, from, to, null, null);
//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();
restpapi.SimpleHTMLEmail();
}*/
}
}
|