dev-master
9999999-dev https://github.com/stijnkoopal/zf2-mailZend Framework 2 module that provides a highly configurable mail service
MIT
The Requires
- php >=5.3.0
The Development Requires
Zend Framework 2 module that provides a highly configurable mail service
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., (*1)
./vendor/
directory.Add this project in your composer.json:, (*2)
"require": { "stijnkoopal/zf2-mail": "dev-master" }
Now tell composer to download Zf2 mail by running the command:, (*3)
$ php composer.phar update
Enabling it in your application.config.php
file., (*4)
<?php return array( 'modules' => array( // ... 'Mailing', ), // ... );
Copy config/mail.global.php.dist and config/mail.local.php.dist to your config directory, (*5)
Thus module has some options to allow you to quickly customize the basic functionality., (*6)
The following options are available:, (*7)
type
and options
key can be specifiedname
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.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.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
.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., (*8)
Zend Framework 2 module that provides a highly configurable mail service
MIT