Mari Jørgensen
Oct 12, 2012
(1 votes)

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.
Latest blogs
Content Delivery API – The Case of the Duplicate API Refresh Token

Creating a custom refresh provider to resolve the issues with duplicate tokens in the DXC The post Content Delivery API – The Case of the Duplicate...

David Lewis | Sep 29, 2022 | Syndicated blog

New Optimizely certifications - register for beta testing before November 1st

In January 2023, Optimizely is making updates to the current versions of our certification exams to make sure that each exam covers the necessary...

Jamilia Buzurukova | Sep 28, 2022

Optimizely community meetup - Sept 29 (virtual + Melbourne)

Super excited to be presenting this Thursday the 29th of September at the Optimizely community meetup. For the full details and RSVP's see the...

Ynze | Sep 27, 2022 | Syndicated blog

Preview multiple Visitor Groups directly while browsing your Optimizely site

Visitor groups are great - it's an easy way to add personalization towards market segments to your site. But it does come with it's own set of...

Allan Thraen | Sep 26, 2022 | Syndicated blog