Coder Social home page Coder Social logo

balaclark / postmark-yii Goto Github PK

View Code? Open in Web Editor NEW

This project forked from znarkus/postmark-php

7.0 0.0 6.0 331 KB

The Postmark PHP class, slightly modified to work with the Yii Framework

Home Page: http://developer.postmarkapp.com/developer-libs.html#php-5

PHP 100.00%

postmark-yii's Introduction

Postmark PHP class

Copyright 2009 - 2010, Markus Hedlund, Mimmin AB, www.mimmin.com Licensed under The MIT License Redistributions of files must retain the above copyright notice.

Additional contributors

  • Jeff Downie
  • August Trometer
  • Hristo Deshev
  • jeffreyhunter77
  • John Beales

Configuration

There are two ways of configuration.

Adapter

An adapter class should be used for a more dynamic configuration. The adapter must implement Mail_Postmark_Adapter_Interface. These are the methods that must be implemented.

  • getApiKey - Should return the API key
  • setupDefaults(Mail_Postmark &$mail) - May be used to setup a default email, e.g. set From address.
  • log($logData) - Is called immediately after the email is sent. $logdata is an array with keys messageData, return, curlError and httpCode.

See Tests/Adapter.php for example usage.

Constants

Constants for configuration are:

  • POSTMARKAPP_API_KEY
  • POSTMARKAPP_MAIL_FROM_ADDRESS
  • POSTMARKAPP_MAIL_FROM_NAME [optional]

POSTMARKAPP_MAIL_FROM_ADDRESS may be omitted, if method from() is called.

Usage

Mail_Postmark::compose()
	->addTo('[email protected]', 'Name')
	->subject('Subject')
	->messagePlain('Plaintext message')
	->send();

or:

$email = new Mail_Postmark();
$email->addTo('[email protected]', 'Name')
	->subject('Subject')
	->messagePlain('Plaintext message')
	->send();

Error handling

See PHPDOC for details on Exceptions thrown. If no API key is set, an E_USER_ERROR will be raised.

Debugging

Call method debug(Mail_Postmark::DEBUG_VERBOSE) or debug(Mail_Postmark::DEBUG_RETURN) to enable debug mode. DEBUG_VERBOSE prints debug info and DEBUG_RETURN makes send() return debug info as an array.

Unit tests

Unit tests are located in Tests/. Simple test is the unit test framework being used.

Adapter.php runs all tests relevant for adapter configuration, Constants.php runs relevant tests for constant configration.

postmark-yii's People

Contributors

balaclark avatar jeffreyhunter77 avatar znarkus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.