t4web / mail
ZF2 Module. Send mails, managing mail templates and mail log.
Installs: 55
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Type:zf2-module
Requires
- php: >=5.5
- t4web/admin: dev-master
- t4web/crud: ~1.0.0
- t4web/default-service: ~1.0.0
- t4web/domain-module: ~1.2.0
- t4web/event-subscriber: ~1.0.0
- zendframework/zend-console: ^2.5
- zendframework/zend-db: ^2.5
- zendframework/zend-mail: ^2.5
- zendframework/zend-mime: ^2.5
- zendframework/zend-modulemanager: ^2.5
- zendframework/zend-mvc: ^2.5
- zendframework/zend-servicemanager: ^2.5
- zendframework/zend-text: ^2.5
- zendframework/zend-view: ^2.5
Requires (Dev)
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ^2.3
Suggests
- acelaya/zf2-acmailer: Mail sending module for Zend Framework 2 with support for file attachment and template email composition
This package is auto-updated.
Last update: 2024-10-26 18:01:22 UTC
README
ZF2 Module. Send mails, managing mail templates and mail log.
Installation
Main Setup
By cloning project
Clone this project into your ./vendor/
directory.
With composer
Add this project in your composer.json:
"require": { "t4web/mail": "~1.0.0" }
Now tell composer to download T4web\Mail
by running the command:
$ php composer.phar update #### Post installation Enabling it in your `application.config.php`file. ```php <?php return array( 'modules' => array( // ... 'T4web\Mail', ), // ... );
Configuring
For define mail templates, describe it in config:
't4web-mail' => [ // Global for all mails 'from-email' => 'support@your-domain.com', // Global for all mails 'from-name' => 'Your project name', 'templates' => [ // Template id T4web\Mail\Template::FEEDBACK_ANSWER => [ 'subject' => 'Feedback answer', 'template' => 't4web-mail/template/feedback-answer', 'layout' => T4web\Mail\Template::LAYOUT_DEFAULT, ], ], 'layout' => [ // Layout id => layout template T4web\Mail\Template::LAYOUT_DEFAULT => 't4web-mail/layout/default', ], ],
Template may be like this template/feedback-answer.phtml
Using
$sender = $this->getServiceLocator()->get(\T4web\Mail\Sender::class); $to = 'receiver@email.com'; $data = [ 'userName' => 'Max', 'message' => 'My message', 'answer' => 'My answer', ]; $sender->send($to, \T4web\Mail\Template::FEEDBACK_ANSWER, $data);