netglue/ng-mtmail 问题修复 & 功能扩展

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

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

netglue/ng-mtmail

最新稳定版本:0.1

Composer 安装命令:

composer require netglue/ng-mtmail

包简介

ZF2 Module providing a multipart template driven email message creation service using the ZF view layer

README 文档

README

This module for ZF2 provides a simple service that creates and returns multipart/alternative email messages by simply providing a view script name and a view model|array|traversable to the createMessage() method of the service. The model vars are interpolated into the view script as you'd expect and there's a filter that converts the resultant HTML into plain text automatically.

Although untested, you should be able to pass in the standard template resolver from config so you can easily drop your view scripts into an already available view script path.

REQUIREMENTS

INSTALLATION

The module can be installed with composer. Just add require { "netglue/ng-mtmail" : "dev-master" } to your composer.json file

USAGE

Within your app somewhere... Like in a controller or something,

#!php

use Zend\Mail\Transport\Sendmail;

$sl = $this->getServiceLocator();
$service = $sl->get('MailTemplate');
$model = array(
	'message' => 'How do?',
);
$message = $service->createMessage('example/example', $model);
$message->setSubject('Test Message')
	->addTo('me@example.com')
	->addFrom('me@example.com');

$transport = new Sendmail;
$transport->send($message);

In the default configuration, the view script path is setup to ModuleRoot/view in there is an example template in example/example.phtml hence the example/example parameter to createMessage()

The second parameter to createMessage() is the ViewModel which can be a ready intantiated Zend\View\Model\ViewModel, a Zend\View\Variables object, an array, something that implements Traversable or NULL

You'll have to setup your own transport or get an existing one from the service manager or something...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-11-22