Version 0.0.2 Created by the goalio UG (haftungsbeschränkt)
Provide configurable Mail Transport Factory and simple messaging for ZF2
- Zend Framework 2 (latest master).
- Configure transport service for using Zend\Mail [COMPLETE]
-
Add this project and the requirements in your composer.json:
"require": { "goalio/goalio-mailservice": "dev-master" }
-
Now tell composer to download ZfcUser by running the command:
$ php composer.phar update
-
Enabling it in your
application.config.php
file.<?php return array( 'modules' => array( // ... 'GoalioMailService' ), // ... );
-
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. -
If you are using the FileTransport (for development) create the directory
./data/mail
.
// 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);