Created
October 11, 2013 16:20
-
-
Save brandonmwest/6937700 to your computer and use it in GitHub Desktop.
Send an email with categories using sendgrid-csharp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the email object first, then add the properties. | |
SendGrid myMessage = SendGrid.GetInstance(); | |
myMessage.AddTo("anna@example.com"); | |
myMessage.From = new MailAddress("john@example.com", "John Smith"); | |
myMessage.Subject = "Testing the SendGrid Library"; | |
myMessage.Text = "Hello World!"; | |
string[] categories = new string[3] {"category1", "category2", "category3"}; | |
myMessage.SetCategories(categories); | |
// Create credentials, specifying your user name and password. | |
var credentials = new NetworkCredential("username", "password"); | |
// Create an SMTP transport for sending email. | |
var transportSMTP = SMTP.GetInstance(credentials); | |
// Send the email. | |
transportSMTP.Deliver(myMessage); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment