molajo/email

Molajo Email: platform independent support with adapters for PHPMailer, SwiftMail, and native PHP mail

Installs: 441

Dependents: 2

Suggesters: 1

Security: 0

Stars: 0

Watchers: 5

Forks: 1

Open Issues: 0

Type:molajo-package

v0.4 2014-04-07 15:45 UTC

This package is auto-updated.

Last update: 2024-03-08 03:26:15 UTC


README

Build Status

Email Services API for PHP applications enabling interaction with multiple Email types (ex., PHP Mail, PHP Mailer, Swiftmailer, etc.).

At a glance ...

  1. Instantiate a Mail Handler.
  2. Instantiate the Adapter, injecting it with the Handler.
  3. Set mail parameters.
  4. Send mail.
    // 1. Instantiate an Email Handler.
    $options                     = array();
    $options['mailer_transport'] = 'mail';
    $options['site_name']        = 'Sitename';
    $options['Fieldhandler']     = new Fieldhandler();

    $class   = 'Molajo\\Email\\Handler\\PhpMailer';
    $handler = new $class($options);

    // 2. Instantiate the Adapter, injecting it with the Handler.
    $class         = 'Molajo\\Email\\Adapter';
    $this->adapter = new $class($handler);

    // 3. Set email parameters
    $this->adapter->set('to', 'AmyStephen@Molajo.org,Fname Lname');
    $this->adapter->set('from', 'AmyStephen@Molajo.org,Fname Lname');
    $this->adapter->set('reply_to', 'AmyStephen@Molajo.org,FName LName');
    $this->adapter->set('cc', 'AmyStephen@Molajo.org,FName LName');
    $this->adapter->set('bcc', 'AmyStephen@Molajo.org,FName LName');
    $this->adapter->set('subject', 'Welcome to our Site');
    $this->adapter->set('body', 'Stuff goes here');
    $this->adapter->set('mailer_html_or_text', 'text');

    // 4. Send Email.
    $this->adapter->send();

Install using Composer from Packagist

Step 1: Install composer in your project

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

Step 2: Create a composer.json file in your project root

{
    "require": {
        "Molajo/Email": "1.*"
    }
}

Step 3: Install via composer

    php composer.phar install

Requirements and Compliance