Giter Site home page Giter Site logo

goaliomailservice's Introduction

GoalioMailService

Version 1.2.0 Created by the goalio UG (haftungsbeschränkt)

Introduction

Provide configurable Mail Transport Factory and simple messaging for ZF2

Requirements

Features / Goals

  • Configure transport service for using Zend\Mail [COMPLETE]

Changelog

With ZF2.3 the Transport Factory changed. This made changes to the configuration in the goaliomailservice.global.php (and goaliomailservice.local.php) neccessary. I tried to check this in my own factory, but please be aware of this.

Installation

Main Setup

With composer

  1. Add this project and the requirements in your composer.json:

    "require": {
        "goalio/goalio-mailservice": "1.*"
    }
  2. Now tell composer to download GoalioMailService by running the command:

    $ php composer.phar update

Post installation

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

    <?php
    return array(
        'modules' => array(
            // ...
            'GoalioMailService'
        ),
        // ...
    );
  2. Copy the configuration files for local and global from ./vendor/goalio/goalio-mailservice/config/goaliomailservice.{local,global}.php.dist to ./config/autoload/goaliomailservice.{local,global}.php and change the values as desired.

  3. If you are using the FileTransport (for development) create the directory ./data/mail.

Usage

// The template used by the PhpRenderer to create the content of the mail
$viewTemplate = 'module/email/testmail';

// The ViewModel variables to pass into the renderer
$value = array('foo' => 'bar');

$mailService = $this->getServiceManager()->get('goaliomailservice_message');
$message = $mailService->createTextMessage($from, $to, $subject, $viewTemplate, $values);
$mailService->send($message);

SMTP Setup

GoalioMailService uses sendmail by default, but you can set it up to use SMTP by putting your information in the config file like this:

$settings = array(
    'type' => 'Zend\Mail\Transport\Smtp',

    'options_class' => 'Zend\Mail\Transport\SmtpOptions',

    'options' => array(
        'host' => 'smtp.gmail.com',
        'connection_class' => 'login',
        'connection_config' => array(
            'ssl' => 'tls',
            'username' => '[email protected]',
            'password' => 'YOUR-PASSWORD-HERE'
        ),
        'port' => 587
    )
);

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.