PHPackages                             znarkus/postmark - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. znarkus/postmark

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

znarkus/postmark
================

Postmark PHP class

0.1.0(11y ago)13789.7k↓31.7%47[5 issues](https://github.com/Znarkus/postmark-php/issues)[3 PRs](https://github.com/Znarkus/postmark-php/pulls)1MIT LicensePHP

Since Jun 10Pushed 3y ago4 watchersCompare

[ Source](https://github.com/Znarkus/postmark-php)[ Packagist](https://packagist.org/packages/znarkus/postmark)[ Docs](https://github.com/Znarkus/postmark-php)[ RSS](/packages/znarkus-postmark/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Postmark PHP class
==================

[](#postmark-php-class)

Copyright 2009 - 2011, Markus Hedlund, Mimmin AB, [www.mimmin.com](http://www.mimmin.com)Licensed under the MIT License. Redistributions of files must retain the above copyright notice.

### Additional contributors

[](#additional-contributors)

- Jeff Downie
- August Trometer
- Hristo Deshev
- jeffreyhunter77
- John Beales
- Geoff Wagstaff
- beaudesigns
- Gabriel Bull

Requirements
------------

[](#requirements)

All in-data must be encoded with UTF-8.

Getting started
---------------

[](#getting-started)

```
// Create a "server" in your "rack", then copy it's API key
$postmarkApiKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';

// Create a message and send it
Postmark\Mail::compose($postmarkApiKey)
    ->from('john@smith.com', 'John Smith')
    ->addTo('jane@smith.com', 'Jane Smith')
    ->subject('Subject')
    ->messagePlain('Plaintext message')
    ->send();
```

Configuration
-------------

[](#configuration)

There are two ways of configuration.

### Adapter

[](#adapter)

An adapter class should be used for a more dynamic configuration. The adapter must implement Postmark\\MailAdapterInterface. These are the methods that must be implemented.

- `getApiKey` - Should return the API key
- `setupDefaults(Postmark\Mail &$mail)` - May be used to setup a default email, e.g. set From address.
- `log($logData)` - Is called immediately after the email is sent. `$logdata` is an array with keys `messageData`, `return`, `curlError` and `httpCode`.

See `Tests/Adapter.php` for example usage.

Usage
-----

[](#usage)

```
Postmark\Mail::compose($postmarkApiKey)
	->from('address@example.com', 'Name')
	->addTo('address@example.com', 'Name')
	->subject('Subject')
	->messagePlain('Plaintext message')
	->send();
```

or:

```
$email = new Postmark\Mail($postmarkApiKey);
$email->from('address@example.com', 'Name')
	->addTo('address@example.com', 'Name')
	->subject('Subject')
	->messagePlain('Plaintext message')
	->send();
```

Error handling
--------------

[](#error-handling)

See PHPDOC for details on Exceptions thrown. If no API key is set, an E\_USER\_ERROR will be raised.

Debugging
---------

[](#debugging)

Call method `debug(Postmark\Mail::DEBUG_VERBOSE)` or `debug(Postmark\Mail::DEBUG_RETURN)` to enable debug mode. `DEBUG_VERBOSE` prints debug info and `DEBUG_RETURN` makes `send()` return debug info as an array.

Unit tests
----------

[](#unit-tests)

Unit tests are located in `Tests/`. Simple test is the unit test framework being used.

`Adapter.php` runs all tests relevant for adapter configuration.

E-mail address validation
-------------------------

[](#e-mail-address-validation)

This class uses a regular expression to validate e-mail addresses, in addition to the validation Postmark does. This regex isn't perfect. If you need more extensive validation, please try .

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4361d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fcd3c0ec0f06b3ff94878dbcf5dad6bdfa1813c2c0bf753af44dd3184c3a2a04?d=identicon)[gabrielbull](/maintainers/gabrielbull)

---

Top Contributors

[![Znarkus](https://avatars.githubusercontent.com/u/168042?v=4)](https://github.com/Znarkus "Znarkus (21 commits)")[![jeffreyhunter77](https://avatars.githubusercontent.com/u/33921?v=4)](https://github.com/jeffreyhunter77 "jeffreyhunter77 (1 commits)")[![onassar](https://avatars.githubusercontent.com/u/612938?v=4)](https://github.com/onassar "onassar (1 commits)")[![TheDeveloper](https://avatars.githubusercontent.com/u/432425?v=4)](https://github.com/TheDeveloper "TheDeveloper (1 commits)")

---

Tags

emailpostmark

### Embed Badge

![Health badge](/badges/znarkus-postmark/health.svg)

```
[![Health](https://phpackages.com/badges/znarkus-postmark/health.svg)](https://phpackages.com/packages/znarkus-postmark)
```

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[sendgrid/sendgrid

This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.

1.5k47.5M164](/packages/sendgrid-sendgrid)[pelago/emogrifier

Converts CSS styles into inline style attributes in your HTML code

94944.1M110](/packages/pelago-emogrifier)[zbateson/mail-mime-parser

MIME email message parser

54149.2M79](/packages/zbateson-mail-mime-parser)[coconutcraig/laravel-postmark

Laravel package for sending mail via the Postmark API

2152.9M1](/packages/coconutcraig-laravel-postmark)[soundasleep/html2text

A PHP script to convert HTML into a plain text format

48519.5M75](/packages/soundasleep-html2text)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
