ogogo/mailservice 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ogogo/mailservice

Composer 安装命令:

composer require ogogo/mailservice

包简介

Provide configurable Mail Transport Factories for ZF2 (Custom)

关键字:

README 文档

README

Version 1.0 Created by Finbarr

Introduction

Provide configurable Mail Transport Factory and simple messaging for ZF2

Requirements

Features / Goals

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

Installation

Main Setup

With composer

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

    "require": {
        "ogogo/mailservice": "dev-master"
    }
  2. Now tell composer to download ZfcUser by running the command:

    $ php composer.phar update

Post installation

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

    <?php
    return array(
        'modules' => array(
            // ...
            'MailService'
        ),
        // ...
    );
  2. Copy the configuration files for local and global from ./vendor/ogogo/mailservice/config/mailservice.{local,global}.php.dist to ./config/autoload/mailservice.{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('mailservice_message');
$message = $mailService->createTextMessage($from, $to, $subject, $viewTemplate, $values);	
$mailService->send($message);

SMTP Setup

MailService 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(
    'transport_class' => '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' => 'YOUR-USERNAME-HERE@gmail.com',
            'password' => 'YOUR-PASSWORD-HERE'
        ),
        'port' => 587
    )
);

统计信息

  • 总下载量: 32
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-01-30