2017 © Pedro Peláez
 

symfony-bundle postmark-bundle

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability.

image

ruudk/postmark-bundle

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability.

  • Monday, January 20, 2014
  • by ruudk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 41 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

RuudkPostmarkBundle

Build Status, (*1)

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability., (*2)

Installation

Step1: Require the package with Composer

php composer.phar require ruudk/postmark-bundle, (*3)

Step2: Enable the bundles

Enable the bundles in the kernel:, (*4)

``` php <?php // app/AppKernel.php, (*5)

public function registerBundles() { $bundles = array( // ... new BCC\ResqueBundle\BCCResqueBundle(), new Ruudk\PostmarkBundle\RuudkPostmarkBundle(), ); }, (*6)


### Step3: Configure Configure the bundle. ``` yaml # app/config/config_prod.yml ruudk_postmark: token: API KEY

Optionally, you can specify extra options, (*7)

``` yaml ruudk_postmark: delayed: true # Offload everything to a Resque worker by default disable_delivery: false # Set true for test environment from: email: info@my-app.com # Default from email name: My App, Inc # Default from name resque: queue: my-queue-name # Resque queue name to use, default is 'postmark' curl: timeout: 10 # Default Buzz\Curl timeout is 5 connect_timeout: 2, (*8)


If you want to configure the BCCResqueBundle, check the [docs](https://github.com/michelsalib/BCCResqueBundle#optional-set-configuration). Congratulations! You're ready. ## Usage ### Composing messages ````php /** * @var \Ruudk\PostmarkBundle\Postmark\Postmark $postmark */ $postmark = $this->container->get('ruudk_postmark.postmark'); $message = $postmark->compose(); $message->addTo('test@gmail.com'); $message->setSubject('Subject'); $message->setTextBody('Body'); $message->setHtmlBody('Body');

Sending messages

If you want to send the message directly:, (*9)

$postmark->send($message);

To send the message to a Resque worker, add an extra delayed() method:, (*10)

$postmark->delayed()->send($message);

Batches

To send multiple messages in a batch (one API call):, (*11)

$postmark->enqueue($message1);
$postmark->enqueue($anotherMessage);

$postmark->send();

Twig templates

This bundle supports Twig so that you can send a new message using a Twig template as a base., (*12)

Create a Twig template with a couple of blocks. It's not necessary to have them all., (*13)

{# AppBundle:Mail:email.html.twig #}
{% block subject %}
The subject of the message
{% endblock %}

{% block text %}
Hi {{ name }},

How are you today?
{% endblock text %}

{% block html %}


Hi {{ name }},, (*14)

<p>How are you today?</p> {% endblock html %}

And compose the message:, (*15)

$message = $postmark->compose('AppBundle:Mail:email.html.twig', array(
    'name' => 'Ruud'
));
$message->addTo('test@gmail.com');

$postmark->send($message);

Resque

If you want to use a Resque worker to send the messages you'll have to start the worker first: php app/console bcc:resque:worker-start -f postmark, (*16)

Now when you send a message with the delayed() method the worker will pick it up and send it., (*17)

Author

Ruud Kamphuis, (*18)

The Versions

20/01 2014

dev-master

9999999-dev http://github.com/ruudk/PostmarkBundle

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruud Kamphuis

symfony2 postmark resque

14/05 2013

0.1.3

0.1.3.0 http://github.com/ruudk/PostmarkBundle

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruud Kamphuis

symfony2 postmark resque

26/03 2013

0.1.2

0.1.2.0 http://github.com/ruudk/PostmarkBundle

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruud Kamphuis

symfony2 postmark resque

25/03 2013

0.1.1

0.1.1.0 http://github.com/ruudk/PostmarkBundle

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruud Kamphuis

symfony2 postmark resque

25/03 2013

0.1.0

0.1.0.0 http://github.com/ruudk/PostmarkBundle

This bundle lets you send messages via Postmark. It can offload the sending of messages to a Resque worker for speed and reliability.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruud Kamphuis

symfony2 postmark resque