centralapps / mail-postmarkapp
PostMarkApp Support for Abstract Mail Component
Installs: 1 144
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 3
Open Issues: 0
Requires
- php: >=5.3.0
- centralapps/mail-core: v1.0.0
This package is not auto-updated.
Last update: 2024-11-09 12:57:48 UTC
README
This is the postmarkapp integration for the centralapps\mail component, an abstract mail sending and receiving component.
Created by Michael Peacock
Installation
Using Composer
-
Add to your
composer.json
file{ "require": { "centralapps/mail": "dev-master", "centralapps/mail-postmarkapp": "dev-master" } }
-
Download composer
curl -s https://getcomposer.org/installer | php
-
Install the dependencies
php composer.phar install
Usage
<?php
require_once( __DIR__ . '/../vendor/autoload.php');
// Configs & Create a mail transportation layer and a dispatcher
$configuration = new \CentralApps\PostMarkApp\Configuration();
$configuration['api_key'] = "YOUR POSTMARKAPP API KEY GOES HERE";
$transport = new \CentralApps\PostMarkApp\Transport($configuration);
$dispatcher = new \CentralApps\Mail\Dispatcher($transport);
// Create a sender
$sender = new \CentralApps\Mail\SendersReceiversEtc\Sender("sender@domain.com", "Sender Name");
// Create a recipient
$recipient = new \CentralApps\Mail\SendersReceiversEtc\Recipient("recipient@domain.com", "Recipient Name");
// Create a message
$message = new \CentralApps\PostMarkApp\Message();
$message->setSender($sender);
$message->addRecipient($recipient);
$message->setSubject('Subject');
$message->setPlainTextMessage("Hi there");
// Send the message
$dispatcher->send($message);