Skip to content

Instantly share code, notes, and snippets.

@jptoto
Created April 18, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jptoto/dab8df4da803ca2ecfc6 to your computer and use it in GitHub Desktop.
Save jptoto/dab8df4da803ca2ecfc6 to your computer and use it in GitHub Desktop.
Sending a message with Postmark Async
using System.Threading.Tasks;
using PostmarkDotNet;
namespace ConsolePostmarkLibTester
{
class Program
{
static void Main(string[] args)
{
Task.Run(async () =>
{
PostmarkMessage message = new PostmarkMessage
{
From = "sender@example.com",
To = "recip@example.com",
Subject = "Test",
HtmlBody = "Hello",
TextBody = "Hello",
ReplyTo = "reply@example.com"
};
// Adding attachments
// See http://developer.postmarkapp.com/developer-build.html#attachments for allowed extensions.
//message.AddAttachment(fileName, "Content-Type");
PostmarkClient client = new PostmarkClient("api_token");
var result = await client.SendMessageAsync(message);
}).Wait();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment