Skip to content

postageapp/postageapp-cakephp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

PostageApp for CakePHP

This is a component for CakePHP to replace the EmailComponent and allows you to send emails with PostageApp service. Personalized, mass email sending can be offloaded to PostageApp via the JSON based API.

Installation

Manual

GIT Submodule

In your app directory type:

git submodule add git://github.com/postageapp/postageapp-cakephp.git plugins/postage
git submodule init
git submodule update

GIT Clone

In your plugin directory type

git clone git://github.com/postageapp/postageapp-cakephp.git postage

Usage

PostageApp for CakePHP works very similarly to built-in EmailComponent. Here's a simple example (in a controller):

var $components = array('Postage.Postage' => array(
    'api_key' => 'PLEASE CHANGE ME TO YOUR PROJECT API KEY',
));

function send() {
    $this->Postage->from = 'sender@test.test';
    $this->Postage->to = 'recipient@test.test';
    $this->Postage->subject = 'Example Email';
    $this->Postage->htmlMessage = '<strong>Example Message</strong>';
    $this->Postage->textMessage = 'Example Message';
    $this->Postage->attachments = array('/path/to/a/file.ext', '/path/to/a/file2.ext');

    $this->Postage->template = 'test-template';
    $this->Postage->variables = array('variable' => 'value');

    $this->Postage->send(); # returns JSON response from the server
}

Recipients can be specified in a number of ways. Here's how you define a list of them with variables attached:

$this->Postage->to = array(
  'recipient1@example.com' => array('variable1' => 'value',
                                    'variable2' => 'value'),
  'recipient2@example.com' => array('variable1' => 'value',
                                    'variable2' => 'value')
);

For more information about formatting of recipients, templates and variables please see documentation

About

A CakePHP component to allow sending emails through PostageApp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages