Views: 4495
Number of votes: 1
Average rating:

Improve email delivery by integrating EPiServer with Postmark

Guaranteeing email delivery is not an easy task. There are many variables involved that could prevent your emails from being delivered. You don’t know if they are bouncing, ending up in the spam folder or just failing altogether.

If email communication is essential for your site or application,  it is a good idea to leave it to the professionals.

Postmark is a service that any developer can use to ensure the correct delivery of transactional mail – and you set it up in less than 5 minutes.

Getting started

  • Create an account
  • Create a new virtual server (one for each web application)
  • Add sender signatures (from addresses that are verified)

I would also recommend that you setup email authentication for your DNS records, as this will be a major benefit. Email authentication is a way to tell receiving mail servers (Gmail, Yahoo, etc.) that Postmark (or anyone else specified) is allowed to send for your domain.

Using it in your application

You can install a Postmark .NET library using nuget:


Below is a simple example of how you can use the API. In addition to support for async sending, Postmark exposes bounces over a REST-based API, a hook URL for inbound emails (JSON POST data) and can be configured using smtp. Visit to get a complete list of functionality.

public bool SendMail(string toAddress, string subject, 
string mailBodyText, string htmlBody) { // server token is API key generated when setting up postmark server string my_server_token = GetPostmarkServerToken(); PostmarkMessage message = new PostmarkMessage { // the signature address used when setting up your server
From = GetSignature(), To = toAddress, Subject = subject, HtmlBody = htmlBody, TextBody = mailBodyText }; _log.Debug(string.Format("Trying to send mail to '{0}' through Postmark service",
toAddress)); PostmarkClient client = new PostmarkClient(my_server_token); PostmarkResponse response = client.SendMessage(message); if (response.Status == PostmarkStatus.Success) return true; _log.Debug(string.Format("Failed to send mail to '{0}' through PostMaster.
Postmark response is {1}."
, toAddress, response.Status)); return false; }

In our solution we used Postmark for sending emails related to user registration and password reset.

Keep in mind

  • Postmark is for transactional email only, not for newsletters or other bulk email
  • Maximum size is 10mb
  • Review list of accepted file types to make sure your attachments are accepted
  • Maximum recipients for each email is 20
Oct 12, 2012

Please login to comment.