urbanindo / yii2-mail-object
This wraps Yii2 mailer as an object
Installs: 12 593
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- yiisoft/yii2: >=2.0.13
Requires (Dev)
- phing/phing: ~2.16.1
- phpunit/php-code-coverage: ~5.3.2
- phpunit/phpunit: ~6.5.8
- yiisoft/yii2-swiftmailer: ~2.0.0
This package is auto-updated.
Last update: 2024-11-22 17:30:09 UTC
README
This wraps mail object that can be instantiated rather standalone.
Usage
Create new mail object class using MailObject
.
e.g.
class DummyMail extends MailObject { protected function getSubject(): string { return 'Hello, World!'; } protected function getContentParams(): array { return [ 'recipientName' => 'Jane Doe', ]; } protected function getRecipient(): array { return [ 'jane.doe@example.com' => 'Jane Doe', ]; } }
Create html.php
and text.php
for HTML-formatted and plain text email respectively.
To send the object, simply.
$mail = new DummyMail(); $mail->send();
Testing
To run testing, execute
./vendor/bin/phing test