Jump to Content

Objective HTML

Postmaster

The definitive email solution for ExpressionEngine

Service API

Overview

The Base Service class is the class from which all other email services are extended. To create your own service create your own class that extends the Base_service class.

Services Directory
/system/expressionengine/third_party/postmaster/services
Class Suffix
_postmaster_service

Example


class Your_email_service_postmaster_service extends Base_service {

	public $name        = 'Your Email Service';
	public $url         = 'https://your-email-service.com';
	public $description = 'Your email service description';

	public function __construct()
	{
		parent::__construct();		
	}

	public function send($parsed_object, $parcel)
	{
		// Send your email
	}
}

Properties

$curl
An alias of the cURL object.
$description
The description of the parcel or hook.
$name
The name of the parcel or hook.
$now
$id
The unique identifier for each email service.
The current GMT Unix timestamp
$response
The service response from the email service after the email has been sent.
$uid
A UUID object.

Extends

Postmaster Base API

Methods

default_settings()

This method returns an object of the default settings.

Return

(object) Any object

get_settings($settings)

The get_settings method accepts an array of settings which is used to return only the settings assigned to the email service.

$settings
The an associative array of settings
Return

(array) an empty or associative array of settings.

action_url($class, $method)

The action_url() method returns an ACT URL by specifying a class and method.

$class
A valid class name
$method
A valid method name
Return

(string) A valid URL

call_url($method, $params = array())

The call_url() method return an ACT url or the call method.

$method
A valid methd name to call
$params
Arguments that get passed to the method.
Return

(string) A valid URL

delegate_url()

The delegate_url() method returns an ACT URL for the delagate_action method.

Return

(string) A valid URL

json($data)

The json() method outputs JSON with the proper content headers.

$data
A valid JSON string
Return

(string) A valid URL

send($parsed_object, $obj) abstract

The send methods accepts a parsed_object and parcel or hook object.

$parsed_object
The parsed_object contains an object that has been parsed by Postmaster.
$obj
This is the parcel or hook object which is used to send the email.
Return

(object) Postmaster_Service_Response

show_error($error)

The show_error() method outputs an error.

$error
An error string
Return

(string) A valid URL