sobit / swiftmailer-component
Component for Yii Framework based application which provides simple configuration interface for Swift Mailer library.
Installs: 1 364
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.0
- swiftmailer/swiftmailer: 5.1.*
- yiisoft/yii: 1.1.*
This package is not auto-updated.
Last update: 2024-12-31 01:40:15 UTC
README
Component for Yii Framework based application which provides simple configuration interface for Swift Mailer library.
Installation
Add dependency to your composer.json
file:
{ "require": { "sobit/swiftmailer-component": "dev-master" } }
Update your protected/config/main.php
file:
<?php Yii::setPathOfAlias('vendor', dirname(__FILE__) . '/../../vendor'); return array( 'components' => array( 'mailer' => array( 'class' => 'vendor.sobit.swiftmailer-component.SwiftMailerComponent', 'swiftBasePath' => dirname(__FILE__) . '/../../vendor/swiftmailer/swiftmailer', 'host' => 'localhost', // smtp host 'port' => 25, // smtp port 'username' => null, // username 'password' => null, // password 'security' => null, // security, e.g. "ssl" ), ), );
Usage
Most simple usage example:
$message = Yii::app()->mailer ->createMessage('Test subject', 'Test body content') ->setFrom(array('john@doe.com' => 'John Doe')) ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name')) ; Yii::app()->mailer->send($message);