Download the PHP package wasabi/wasabimail without Composer
On this page you can find all versions of the php package wasabi/wasabimail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wasabi/wasabimail
More information about wasabi/wasabimail
Files in wasabi/wasabimail
Package wasabimail
Short Description Zend Framework 2 Email Module Service. This Email module enhances ZF2 email functionality for a convenient usage. It supports file attachments and template email composition. It is bundled with a responsive email template that can be customized.
License MIT License
Homepage https://github.com/wasabiLib/mail
Informations about the package wasabimail
Wasabi Mail Module for Zend Framework 2
This Email module enhances ZF2 email functionality for a convenient usage. It supports file attachments and template email composition.
Configuration
The Mail Module is configured as a service and registered to the service manager. You have 3 default env-types for configuration in vendor/WasabiMail/config.php:
- local - sended emails are saved as text files in vendor/WasabiMail/localMails
- develop - for staging or development servers. It is supposed that a Mail-Server is accessible. Emails are sended to the given address in the config.php
- production - The transporter is SendMail. This can only be changed in the Module.php
You can change this behavior in the Module.php if necessary.
Setting the Environment type
It is recommended to set the env-type in the local.php of the config-folder. Normaly this file will not be deployed and should differ from the specific server environment.
Copy the following code into the local.php
"env" => array(
"type" => "local"
#"type" => "develop"
#"type" => "production"
),
Make sure that only one type is active.
Examples
Simple Usage
$mail = $this->getServiceLocator()->get("Mail");
$mail->setBody("Hello World");
$mail->setTo("[email protected]");
$mail->send();
Using Html Templates
Using a template for sending emails is based on the ViewModel approach of ZF2. You only need to create a new ZF2 ViewModel instance, set your template, fill in your variables and pass it to the setBody method of the Mail Module.
WasabiMail is bundled with a responsive Html Email-Template that you can customize for your own needs. This template is tested with common email clients like Microsoft Outlook or Google Mail.
$mail = $this->getServiceLocator()->get("Mail");
$viewModel = new ViewModel();
$viewModel->setTemplate("responsive");
$mail->setBody($viewModel);
$mail->send();
The template path stack is set to WasabiMail/templates. If necessary you can change this in the config.php
File Attachments
Files can be attached to the email before sending it by providing their paths with addAttachment
the method.
Usage
$mail->addAttachment('data/mail/attachments/file1.pdf');
You can call the method for each attachment you want to attach. You can use the second argument for another name of the file you want to attach. Otherwise the real file name will be used.
All versions of wasabimail with dependencies
zendframework/zend-servicemanager Version ~2.2
zendframework/zend-mail Version ~2.2
zendframework/zend-view Version ~2.2
zendframework/zend-eventmanager Version ~2.2
zendframework/zend-mime Version ~2.2
zendframework/zend-stdlib Version ~2.2
zendframework/zend-modulemanager Version ~2.2
zendframework/zend-mvc Version ~2.2
zendframework/zend-console Version ~2.2
zendframework/zend-config Version ~2.2
zendframework/zend-json Version ~2.2