Postmark ♡ Code Story
With Postmark, you can stop worrying if your emails made it to the inbox, and get back to focusing on what matters—building great products.
With API libraries for pretty much every programming language you can think of, Postmark fits seamlessly into any stack.
// Send an email with the Postmark-PHP library
// Learn more -> https://postmarkapp.com/developer/integration/official-libraries#php
// Install with composer
composer require wildbit/postmark-php
// Import
use Postmark\PostmarkClient;
// Example request
$client = new PostmarkClient("server token");
$sendResult = $client->sendEmail(
"sender@example.com",
"receiver@example.com",
"Hello from Postmark!",
"This is just a friendly 'hello' from your friends at Postmark."
);
# Send an email with the Postmark Ruby Gem
# Learn more -> https://postmarkapp.com/developer/integration/official-libraries#ruby-gem
# Add the Postmark Ruby Gem to your Gemfile
gem 'postmark'
# Require gem
require 'postmark'
# Create an instance of Postmark::ApiClient
client = Postmark::ApiClient.new('POSTMARK_API_TEST')
# Example request
client.deliver(
from: 'sender@example.com',
to: 'receiver@example.com',
subject: 'Hello from Postmark',
html_body: '<strong>Hello</strong> dear Postmark user.',
track_opens: true
)
# Send an email with the Postmark Rails Gem
# Learn more -> https://postmarkapp.com/developer/integration/official-libraries#rails-gem
# Add this to your gemfile
gem 'postmark-rails'
# Add this to your config/application.rb file:
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_token => "POSTMARK_API_TEST" }
# Send the email
class TestMailer < ActionMailer::Base
def hello
mail(
:subject => 'Hello from Postmark',
:to => 'receiver@example.com',
:from => 'sender@example.com',
:html_body => '<strong>Hello</strong> dear Postmark user.',
:track_opens => 'true'
)
end
end
# Send an email with the Postmark Python library
# Learn more -> https://postmarkapp.com/send-email/python
# Install the Postmark Python library with pip from the command line:
pip install postmarker
# Import
from postmarker.core import PostmarkClient
# Create an instance of the Postmark client
postmark = PostmarkClient(server_token='POSTMARK-SERVER-API-TOKEN-HERE')
# Send an email
postmark.emails.send(
From='sender@example.com',
To='recipient@example.com',
Subject='Postmark test',
HtmlBody='HTML body goes here'
)
// Send an email with the Postmark .NET library
// Learn more -> https://postmarkapp.com/developer/integration/official-libraries#dot-net
// Install with NuGet
PM> Install-Package Postmark
// Import
using PostmarkDotNet;
// Example request
PostmarkMessage message = new PostmarkMessage {
From = "sender@example.com",
To = "receiver@example.com",
Subject = "Hello from Postmark",
HtmlBody = "<strong>Hello</strong> dear Postmark user.",
TextBody = "Hello dear postmark user.",
ReplyTo = "reply@example.com",
TrackOpens = true,
Headers = new NameValueCollection {{ "CUSTOM-HEADER", "value" }}
};
PostmarkClient client = new PostmarkClient("POSTMARK_API_TEST");
PostmarkResponse response = client.SendMessage(message);
if(response.Status != PostmarkStatus.Success) {
Console.WriteLine("Response was: " + response.Message);
}
// Send an email with the Postmark.js library
// Learn more -> https://postmarkapp.com/developer/integration/official-libraries#node-js
// Install with npm
npm install postmark --save
// Require
var postmark = require("postmark");
// Example request
var client = new postmark.ServerClient("server token");
client.sendEmail({
"From": "sender@example.com",
"To": "receiver@example.com",
"Subject": "Test",
"TextBody": "Hello from Postmark!"
});
# Send an email with curl
# Copy and paste this into terminal
curl "https://api.postmarkapp.com/email" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Postmark-Server-Token: POSTMARK_API_TEST" \
-d "{From: 'sender@example.com', To: 'receiver@example.com', Subject: 'Hello from Postmark', HtmlBody: '<strong>Hello</strong> dear Postmark user.'}"
Our entire business revolves around never losing a single email and ensuring your emails arrive in the inbox quickly—not eventually.
It’s not just our email delivery that’s fast and reliable. Our knowledgeable customer success team is here for you should you need us (and we never make you pay extra for premium support.)
Customer feedback gathered through Help Scout over the past 60 days.
Plans start at just $15 per month. Great deliverability and top-notch support are always included.
Get in touch to discuss our high-volume tiers.
Tell us how many emails your application sends and receives each month and we’ll find the best tier for you
We’re profitable, privately owned, and in this for the long haul. Since 2010 we’ve delivered billions of emails for companies of all sizes.