Download the PHP package yii1tech/mailer without Composer
On this page you can find all versions of the php package yii1tech/mailer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mailer
Symfony Mailer Extension for Yii 1
This extension provides integration of Symfony Mailer in the Yii1 application.
For license information check the LICENSE-file.
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the "require" section of your composer.json.
Usage
This extension provides integration of Symfony Mailer in the Yii1 application. Application configuration example:
Note: please refer to the Symfony Mailer Manual for the instructions regarding the transport DSN specification.
Usage example:
Configuring Emails Globally
In order to simplify the code and avoid its duplication, you can set the default headers, which should be applied for each sending email. Application configuration example:
Template rendering
You may specify the content for the email body to be a result of rendering a particular view templates.
It works in the similar way as rendering the views in your Web controllers.
You'll need to use \yii1tech\mailer\TemplatedEmail
in order to specify the templates.
By default, the view templates will be searched in the directory "views/mail" in the application base path.
But you may configure \yii1tech\mailer\Mailer::$view
component to use a different folder.
You can also set a global layout for all template rendering.
Application configuration example:
Inside the template file the following variables are always accessible:
$this
- reference to\yii1tech\mailer\View
instance.$_message
- reference to email message instance, which is rendered.
Template example:
Writing unit tests
You can use \yii1tech\mailer\transport\ArrayTransport
while writing unit tests for your application.
This transport will store all incoming email messages inside the internal field instead of actual sending them.
Application configuration example:
Unit test example: