2017 © Pedro Peláez
 

library swiftmailer-postmark

A Swiftmailer Transport for Postmark.

image

wildbit/swiftmailer-postmark

A Swiftmailer Transport for Postmark.

  • Friday, July 20, 2018
  • by atheken
  • Repository
  • 4 Watchers
  • 15 Stars
  • 98,463 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 11 Forks
  • 4 Open issues
  • 13 Versions
  • 5 % Grown

The README.md

swiftmailer-postmark

Build Status, (*1)

An official Swiftmailer Transport for Postmark., (*2)

Send mail through Postmark from your favorite PHP frameworks!, (*3)

You're just steps away from super simple sending via Postmark:, (*4)

1. Include this package in your project:
composer require wildbit/swiftmailer-postmark
2. Use the transport to send a message:
');
$mailer = new Swift_Mailer($transport);

//Instantiate the message you want to send.
$message = (new Swift_Message('Hello from Postmark!'))
  ->setFrom(['john@example.com' => 'John Doe'])
  ->setTo(['jane@example.com'])
  ->setBody('A really important message from our sponsors.', 'text/html')
  ->addPart('Another important message from our sponsors.','text/plain');

//Add some attachment data:
$attachmentData = 'Some attachment data.';
$attachment = new Swift_Attachment($attachmentData, 'my-file.txt', 'application/octet-stream');

$message->attach($attachment);

//Send the message!
$mailer->send($message);
?>
3. Throw exceptions on Postmark api errors:
$transport = new \Postmark\Transport('<SERVER_TOKEN>');
$transport->registerPlugin(new \Postmark\ThrowExceptionOnFailurePlugin());

$message = new Swift_Message('Hello from Postmark!');
$mailer->send($message); // Exception is throw when response !== 200
4. Use default headers:

You can set default headers at Transport-level, to be set on every message, unless overwritten., (*5)

$defaultHeaders = ['X-PM-Tag' => 'my-tag'];

$transport = new \Postmark\Transport('<SERVER_TOKEN>', $defaultHeaders);

$message = new Swift_Message('Hello from Postmark!');

// Overwriting default headers
$message->getHeaders()->addTextHeader('X-PM-Tag', 'custom-tag');
5. Setting the Message Stream:

By default, the "outbound" transactional stream will be used when sending messages., (*6)

// Change the default stream for every message via Default Headers
$transport = new \Postmark\Transport('<SERVER_TOKEN>', ['X-PM-Message-Stream' => 'your-custom-stream']);

$message = new Swift_Message('Hello from Postmark!');

// Overwrite the default stream for a specific message by setting the header
$message->getHeaders()->addTextHeader('X-PM-Message-Stream', 'another-stream');
Notes:
  • The Transport uses the Postmark API internally to send mail, via the /email endpoint. Other sending features such as Batch sending or sending via Templates are currently not supported by this library.

The Versions

20/07 2018

dev-master

9999999-dev

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

20/07 2018

3.0.1

3.0.1.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

20/07 2018

3.0.0

3.0.0.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

20/07 2018

dev-Welkio-swiftmailer-v6

dev-Welkio-swiftmailer-v6

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

18/04 2017

2.1.0

2.1.0.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

13/09 2016

2.0.5

2.0.5.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

26/07 2016

2.0.4

2.0.4.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

18/04 2016

2.0.3

2.0.3.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

10/12 2015

dev-content-disp-fix

dev-content-disp-fix

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

30/11 2015

2.0.2

2.0.2.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

10/11 2015

2.0.0

2.0.0.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

19/03 2015

1.1.0

1.1.0.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark

27/02 2015

1.0.0

1.0.0.0

A Swiftmailer Transport for Postmark.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Postmark