Skip to content
jptoto edited this page Feb 9, 2012 · 3 revisions

Welcome to the postmark-dotnet wiki!

Pre-requisites
- You’ll need to go to http://postmarkapp.com and sign up for a new account.
- You’ll need a server token, obtained when you set up a new server on your existing account.
- You’ll need to verify at least one sender signature, which is the email address used for the “From” value (http://postmarkapp.com/signatures)

Getting Started

using PostmarkDotNet;

PostmarkMessage message = new PostmarkMessage
{
    From = “sender@example.com”,
    To = “receiver@example.com”,
    Subject = “Test”,
    HtmlBody = “Hello”,
    TextBody = “Hello”,
    ReplyTo = “reply@example.com”,
    Headers = new NameValueCollection {{"CUSTOM-HEADER", "value"}}
};

// Adding attachments
// See http://developer.postmarkapp.com/developer-build.html#attachments for allowed extensions.
message.AddAttachment(fileName, "Content-Type");

PostmarkClient client = new PostmarkClient(my_server_token);

PostmarkResponse response = client.SendMessage(message);

if(response.Status != PostmarkStatus.Success)
{
    Console.WriteLine("Response was: " + response.Message);
}
Clone this wiki locally