Code Monkey home page Code Monkey logo

zf2-mail's Introduction

ZF-3 Mail

Introduction

This module provides a highly configurable service for sending emails. It allows you to send emails with both plain as html content. Furthermore, it provides the ability to specify layouts for both content types.

Requirements

Installation

Main Setup

By cloning project (not recommended)

  1. Clone this project into your ./vendor/ directory.

With composer

  1. Add this project in your composer.json:

    "require": {
        "SalesAndOrders/zf3-mail": "dev-master"
    }
  2. Now tell composer to download Zf2 mail by running the command:

    $ php composer.phar update

Post installation

  1. Enabling it in your application.config.phpfile.

    <?php
    return array(
        'modules' => array(
            // ...
            'Mailing',
        ),
        // ...
    );
  2. Copy config/mail.global.php.dist and config/mail.local.php.dist to your config directory

  3. Remove the .dist extension from these files and fill in the blanks

Options

Thus module has some options to allow you to quickly customize the basic functionality.

The following options are available:

  • domains - A array of key value pairs. The default key is used for email addresses that did not specify any domain
  • transport - The specification for the email transport. A type and options key can be specified
  • from - An array of arrays where each inner array should specify the name and email keys. Optionally an domain key can be specified that is available in the domains option. If no domain is specified, default is used.
  • layouts - An array of array where each inner array can specify a plain and/or html key. The value for these keys should point to view file that you have defined in the view_manager configuration. Hence, the view manager from the application is used to locate the view script.
  • mails - An array of arrays where each inner array can specify the following options: from, a value that points to a key in the from options array. layout: a value that points to a key in the layouts array. If not specified, no layout is used. subject: the subject of the email. If not specified the subject in template will be used. template: an array containing the keys html, plain and subject. These should point to a view script specified by the view_manager.

Send email

Let $emailService be an instanceof Mailing\Service. (Can be obtained with the MailingServiceProviderTrait). An email is then send with $email->sendMail($message, 'alias', $variables). The $message variable is an instance of Zend\Mail\Message and you should specify addresses in this object. The second parameter is a key in the mails array specified in the configuration. Variables can be passed as last parameter. These will be available in your view script.

zf2-mail's People

Contributors

stijnkoopal avatar eeyon avatar franco104 avatar

Watchers

James Cloos avatar  avatar Bryan Natter avatar  avatar  avatar  avatar Tomislav Slade avatar Mariano Capielo avatar Sales and Orders avatar Lukas Labryszewski avatar Katie avatar  avatar  avatar Anatolii Kosovilka 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.