lewisbaker/silex-postmarkapp

There is no license information available for the latest version (dev-master) of this package.

PostmarkApp Service Provider for the Silex PHP Microframework

dev-master 2013-02-22 21:15 UTC

This package is not auto-updated.

Last update: 2024-11-17 03:38:54 UTC


README

#PostmarkApp Service Provider for Silex

This is a service provider for the Silex PHP Microframework, it provides access to Postmark app via the CentralApps mail component.

##Installation

  1. Add to your composer.json file

    { "repositories": [ { "type": "vcs", "url": "http://github.com/lewisbaker/PostmarkAppServiceProvider" } ], "require": { "lewisbaker/silex-postmarkapp": "dev-master" } }

  2. Download composer

    curl -s https://getcomposer.org/installer | php

  3. Install the dependencies

    php composer.phar install

##Usage

<?php

$app->register(new LewisB\PostmarkServiceProvider\PostmarkServiceProvider(), array(
    'postmark.default_sender_name' => 'Bob',
    'postmark.default_sender_email' => 'bob@internet.com',
    'postmark.api_key' => 'your-api-key'
));

$sender = $app['postmark.default_email_sender'];
$recipient = new \CentralApps\Mail\SendersReceiversEtc\Recipient("alice@internet.com");
			
$message = new \CentralApps\PostMarkApp\Message();
$message->setSender($sender);
$message->addRecipient($recipient);
$reply_to_email = $app['postmark.default_sender_email'];
$reply_to = new \CentralApps\Mail\SendersReceiversEtc\ReplyTo($reply_to_email);
$message->setReplyTo($reply_to);
$message->setSubject("Greetings");
$message->setPlainTextMessage("hello world!");
$result = $app['postmark']->send($message);