Skip to content

Getting Started

Mark Jan Kordon edited this page Feb 6, 2017 · 6 revisions

Getting started with Postmark is very easy. Let's talk about pre-requisites:

Pre-requisites:

  1. A Postmark Account: Sign up for a new account.
  2. A "Server Token": Set up a new 'server' in your account.
  3. A "Sender Signature": Create a sender signature.

Sending your first email:

Postmark is designed to make sending email super easy, the following snippet shows how easy it is to get started:

public async Task SendTestMessage(){
	
	var client = new PostmarkClient("<server token>");

	try{
		var sendResult = await client.SendMessageAsync("<sender signature>", 
			"ben@example.com", 
			"Hello from Postmark!",
			"This is just a friendly hello from your friends at Postmark.");

		// If there's a problem with the content of your message,
		// the API will still return, but with an error status code, 
		// you should take appropriate steps to resolve/retry if this 
		// happens.
		if (sendResult.Status == PostmarkStatus.Success){ /* Handle success */ }
    	else { /* Resolve issue.*/ }

	}catch{
		// Calls to the client can throw an exception 
		// if the request to the API times out.
	}
}

This is the bare-minimum to send an email using the Postmark client, but you can do a great deal more with with the Postmark.Net library. Take special note that you should replace <server token> with the token you obtained in item two of the pre-requisites, and replace <sender signature> with the signature you obtained from item three of the pre-requisites above.

Next, check out more advanced sending options on our Sending Email wiki page, and the other topics listed in the sidebar on the right of this wiki.

Clone this wiki locally